Skip to content

Commit

Permalink
CreateUser Added!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
mymakarim committed Apr 21, 2020
1 parent 7911989 commit ca47ef5
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 93 deletions.
177 changes: 85 additions & 92 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 26 additions & 1 deletion example/lib/display_posts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,21 @@ class PostsBuilderState extends State<PostsBuilder> {

// yahya

Future<void> createUser({@required String email, @required String username, @required String password, @required List<String> roles}) async {
await widget.wordPress.createUser(
user: wp.User(
email: email,
password: password,
username: username,
roles: roles
)
).then((p) {
print('User created successfully ${p}');
}).catchError((err) {
print('Failed to create user: $err');
});
}

// =====================
// UPDATE START
// =====================
Expand Down Expand Up @@ -343,7 +358,17 @@ class PostsBuilderState extends State<PostsBuilder> {
style: TextStyle(color: Colors.white),
),
),

RaisedButton.icon(
color: Colors.blueAccent,
onPressed: () {
createUser(roles: ["subscriber"], username: "myUserName", password: "123", email: "myEmail@domain.com");
},
icon: Icon(Icons.add_circle, color: Colors.white,),
label: Text(
"Create New User",
style: TextStyle(color: Colors.white),
),
),
RaisedButton.icon(
color: Colors.blueAccent,
onPressed: () {
Expand Down
Loading

0 comments on commit ca47ef5

Please sign in to comment.