Fallback close dialog localization on desktop
This commit is contained in:
+19
-9
@@ -325,30 +325,40 @@ class _PeyaAppState extends ConsumerState<PeyaApp> with WindowListener {
|
||||
);
|
||||
var shouldStopLocalNode = false;
|
||||
if (shouldPromptForLocalNode) {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
if (l10n == null || !mounted) {
|
||||
await _logCloseDebug('handleAppCloseRequest aborted: l10n null or not mounted');
|
||||
if (!mounted) {
|
||||
await _logCloseDebug('handleAppCloseRequest aborted: not mounted');
|
||||
return false;
|
||||
}
|
||||
final dialogContext = _scaffoldMessengerKey.currentContext ?? context;
|
||||
final l10n = AppLocalizations.of(dialogContext);
|
||||
await _logCloseDebug('handleAppCloseRequest showing dialog');
|
||||
final decision = await showDialog<bool?>(
|
||||
context: context,
|
||||
context: dialogContext,
|
||||
builder: (dialogContext) {
|
||||
return AlertDialog(
|
||||
title: Text(l10n.closeWalletNodeDialogTitle),
|
||||
content: Text(l10n.closeWalletNodeDialogBody),
|
||||
title: Text(
|
||||
l10n?.closeWalletNodeDialogTitle ?? 'Close wallet?',
|
||||
),
|
||||
content: Text(
|
||||
l10n?.closeWalletNodeDialogBody ??
|
||||
'A local node is still running. Do you want to keep it running after closing the wallet?',
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(dialogContext).pop(null),
|
||||
child: Text(l10n.cancelAction),
|
||||
child: Text(l10n?.cancelAction ?? 'Cancel'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(dialogContext).pop(false),
|
||||
child: Text(l10n.closeWalletKeepNodeAction),
|
||||
child: Text(
|
||||
l10n?.closeWalletKeepNodeAction ?? 'Keep node running',
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () => Navigator.of(dialogContext).pop(true),
|
||||
child: Text(l10n.closeWalletStopNodeAction),
|
||||
child: Text(
|
||||
l10n?.closeWalletStopNodeAction ?? 'Stop node and close',
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user