Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
medapp_eksad
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qorri_di
medapp_eksad
Commits
0d71183e
Commit
0d71183e
authored
Sep 23, 2022
by
Fikri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
consume api delete
parent
c3e4117c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
3 deletions
+53
-3
contact_api.dart
lib/api/contact_api.dart
+3
-2
admin_contact.dart
lib/dashboard/admin/admin_contact.dart
+50
-1
No files found.
lib/api/contact_api.dart
View file @
0d71183e
...
...
@@ -31,8 +31,9 @@ Future<bool> savecontact(nama, email, nohp, message) async {
}
Future
<
bool
>
deleteContact
(
id
)
async
{
final
response
=
await
http
.
delete
(
Uri
.
parse
(
'
$cmd
/contact/delete/
$id
'
),
final
response
=
await
http
.
post
(
Uri
.
parse
(
'
$cmd
/contact/delete'
),
body:
jsonEncode
({
"idContact"
:
id
}),
headers:
{
'Content-type'
:
'application/json; charset=UTF-8'
,
},
...
...
lib/dashboard/admin/admin_contact.dart
View file @
0d71183e
...
...
@@ -613,7 +613,56 @@ class _Dashboard4State extends State<Dashboard4> {
viewUser
(
context
);
}
else
if
(
value
==
2
)
{
print
(
"you choose Delete..."
);
deleteContact
(
context
);
showDialog
(
context:
context
,
builder:
(
context
)
{
return
AlertDialog
(
title:
const
Text
(
"Warning"
),
content:
Text
(
"Are you sure want to delete data page
${pgm['idContact']}
?"
),
actions:
<
Widget
>[
TextButton
(
child:
const
Text
(
"Yes"
),
onPressed:
()
{
Navigator
.
pop
(
context
);
deleteContact
(
pgm
[
'idContact'
])
.
then
(
(
isSuccess
)
{
if
(
isSuccess
)
{
setState
(()
{});
Scaffold
.
of
(
this
.
context
)
.
showSnackBar
(
const
SnackBar
(
content:
Text
(
"Delete data success"
),
),
);
}
else
{
Scaffold
.
of
(
this
.
context
)
.
showSnackBar
(
const
SnackBar
(
content:
Text
(
"Delete data failed"
),
),
);
}
},
);
},
),
TextButton
(
child:
const
Text
(
"No"
),
onPressed:
()
{
Navigator
.
pop
(
context
);
},
),
],
);
},
);
}
},
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment