Added popup for recipient deletion
This commit is contained in:
@@ -112,13 +112,33 @@ RouteBase payoutShellRoute() => ShellRoute(
|
||||
context,
|
||||
recipient: recipient,
|
||||
),
|
||||
onDeleteRecipient: (recipient) => executeActionWithNotification(
|
||||
onDeleteRecipient: (recipient) async {
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
title: Text(loc.delete),
|
||||
content: Text(loc.deleteRecipientConfirmation),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(dialogContext, false),
|
||||
child: Text(loc.cancel),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () => Navigator.pop(dialogContext, true),
|
||||
child: Text(loc.delete),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (confirmed != true) return;
|
||||
await executeActionWithNotification(
|
||||
context: context,
|
||||
action: () async =>
|
||||
context.read<RecipientsProvider>().delete(recipient.id),
|
||||
successMessage: loc.recipientDeletedSuccessfully,
|
||||
errorMessage: loc.errorDeleteRecipient,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user