Fixed payment method deletion in recipient settings with better flow

This commit is contained in:
Arseni
2026-01-23 16:28:09 +03:00
parent bdb84ac6ac
commit 3765780a4d
7 changed files with 265 additions and 82 deletions

View File

@@ -7,6 +7,7 @@ import 'package:pshared/models/payment/methods/type.dart';
import 'package:pshared/provider/recipient/pmethods.dart';
import 'package:pweb/pages/payment_methods/add/widget.dart';
import 'package:pweb/widgets/dialogs/confirmation_dialog.dart';
import 'package:pweb/generated/i18n/app_localizations.dart';
@@ -28,25 +29,13 @@ class PaymentConfigController {
Future<void> deleteMethod(PaymentMethod method) async {
final methodsProvider = context.read<PaymentMethodsProvider>();
final l10n = AppLocalizations.of(context)!;
final confirmed = await showDialog<bool>(
final confirmed = await showConfirmationDialog(
context: context,
builder: (dialogContext) => AlertDialog(
title: Text(l10n.delete),
content: Text(l10n.deletePaymentConfirmation),
actions: [
TextButton(
onPressed: () => Navigator.pop(dialogContext, false),
child: Text(l10n.cancel),
),
ElevatedButton(
onPressed: () => Navigator.pop(dialogContext, true),
child: Text(l10n.delete),
),
],
),
title: l10n.delete,
message: l10n.deletePaymentConfirmation,
confirmLabel: l10n.delete,
);
if (confirmed == true) {
if (confirmed) {
methodsProvider.delete(method.id);
}
}