This commit is contained in:
Arseni
2026-03-11 18:26:21 +03:00
parent fdd8dd8845
commit 0172176978
46 changed files with 678 additions and 643 deletions

View File

@@ -0,0 +1,22 @@
import 'package:flutter/material.dart';
import 'package:pweb/widgets/dialogs/confirmation_dialog.dart';
import 'package:pweb/generated/i18n/app_localizations.dart';
Future<void> confirmPaymentMethodDelete(
BuildContext context,
VoidCallback onConfirmed,
) async {
final l10n = AppLocalizations.of(context)!;
final confirmed = await showConfirmationDialog(
context: context,
title: l10n.delete,
message: l10n.deletePaymentConfirmation,
confirmLabel: l10n.delete,
);
if (confirmed) {
onConfirmed();
}
}

View File

@@ -50,31 +50,35 @@ StatusView operationStatusViewFromToken(
case 'settled':
return StatusView(
label: l10n.operationStatusSuccessful,
backgroundColor: scheme.tertiaryContainer,
foregroundColor: scheme.onTertiaryContainer,
backgroundColor: Colors.green,
foregroundColor: Colors.white,
);
case 'skipped':
return StatusView(
label: l10n.operationStepStateSkipped,
backgroundColor: scheme.secondaryContainer,
foregroundColor: scheme.onSecondaryContainer,
backgroundColor: Colors.grey,
foregroundColor: Colors.white,
);
case 'error':
case 'failed':
case 'rejected':
case 'aborted':
return StatusView(
label: l10n.operationStatusUnsuccessful,
backgroundColor: scheme.errorContainer,
foregroundColor: scheme.onErrorContainer,
backgroundColor: Colors.red,
foregroundColor: Colors.white,
);
case 'cancelled':
case 'canceled':
return StatusView(
label: l10n.paymentStatusCancelled,
backgroundColor: scheme.surfaceContainerHighest,
foregroundColor: scheme.onSurfaceVariant,
backgroundColor: Colors.blueGrey,
foregroundColor: Colors.white,
);
case 'processing':
case 'running':
case 'executing':
@@ -82,9 +86,10 @@ StatusView operationStatusViewFromToken(
case 'started':
return StatusView(
label: l10n.paymentStatusProcessing,
backgroundColor: scheme.primaryContainer,
foregroundColor: scheme.onPrimaryContainer,
backgroundColor: Colors.orange,
foregroundColor: Colors.white,
);
case 'pending':
case 'queued':
case 'waiting':
@@ -92,26 +97,29 @@ StatusView operationStatusViewFromToken(
case 'scheduled':
return StatusView(
label: l10n.operationStatusPending,
backgroundColor: scheme.secondary,
foregroundColor: scheme.onSecondary,
backgroundColor: Colors.amber,
foregroundColor: Colors.black,
);
case 'needs_attention':
return StatusView(
label: l10n.operationStepStateNeedsAttention,
backgroundColor: scheme.tertiary,
foregroundColor: scheme.onTertiary,
backgroundColor: Colors.grey.shade800,
foregroundColor: Colors.white,
);
case 'retrying':
return StatusView(
label: l10n.operationStepStateRetrying,
backgroundColor: scheme.primary,
foregroundColor: scheme.onPrimary,
backgroundColor: Colors.purple,
foregroundColor: Colors.white,
);
default:
return StatusView(
label: fallbackLabel ?? humanizeOperationStatusToken(token),
backgroundColor: scheme.surfaceContainerHighest,
foregroundColor: scheme.onSurfaceVariant,
backgroundColor: Colors.grey.shade400,
foregroundColor: Colors.black,
);
}
}