Added popup for recipient deletion

This commit is contained in:
Arseni
2026-01-21 18:12:32 +03:00
parent 87f99be01d
commit d374bdc66c
3 changed files with 30 additions and 2 deletions

View File

@@ -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,
),
);
},
),
);
},