Polish wallet refresh UX and close prompt
This commit is contained in:
@@ -171,6 +171,10 @@
|
||||
"settingsTitle": "Settings",
|
||||
"walletSettingsTitle": "Wallet",
|
||||
"switchWalletAction": "Switch wallet",
|
||||
"closeWalletNodeDialogTitle": "Local node is running",
|
||||
"closeWalletNodeDialogBody": "Do you want to keep the local node running after closing the wallet?",
|
||||
"closeWalletKeepNodeAction": "Keep node running",
|
||||
"closeWalletStopNodeAction": "Stop node and close wallet",
|
||||
"showSeedAction": "Show seed",
|
||||
"copySeedAction": "Copy seed",
|
||||
"copyAddressAction": "Copy address",
|
||||
|
||||
@@ -842,6 +842,30 @@ abstract class AppLocalizations {
|
||||
/// **'Switch wallet'**
|
||||
String get switchWalletAction;
|
||||
|
||||
/// No description provided for @closeWalletNodeDialogTitle.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Local node is running'**
|
||||
String get closeWalletNodeDialogTitle;
|
||||
|
||||
/// No description provided for @closeWalletNodeDialogBody.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Do you want to keep the local node running after closing the wallet?'**
|
||||
String get closeWalletNodeDialogBody;
|
||||
|
||||
/// No description provided for @closeWalletKeepNodeAction.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Keep node running'**
|
||||
String get closeWalletKeepNodeAction;
|
||||
|
||||
/// No description provided for @closeWalletStopNodeAction.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Stop node and close wallet'**
|
||||
String get closeWalletStopNodeAction;
|
||||
|
||||
/// No description provided for @showSeedAction.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
||||
@@ -402,6 +402,19 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
@override
|
||||
String get switchWalletAction => 'Switch wallet';
|
||||
|
||||
@override
|
||||
String get closeWalletNodeDialogTitle => 'Local node is running';
|
||||
|
||||
@override
|
||||
String get closeWalletNodeDialogBody =>
|
||||
'Do you want to keep the local node running after closing the wallet?';
|
||||
|
||||
@override
|
||||
String get closeWalletKeepNodeAction => 'Keep node running';
|
||||
|
||||
@override
|
||||
String get closeWalletStopNodeAction => 'Stop node and close wallet';
|
||||
|
||||
@override
|
||||
String get showSeedAction => 'Show seed';
|
||||
|
||||
|
||||
@@ -403,6 +403,19 @@ class AppLocalizationsPl extends AppLocalizations {
|
||||
@override
|
||||
String get switchWalletAction => 'Przełącz portfel';
|
||||
|
||||
@override
|
||||
String get closeWalletNodeDialogTitle => 'Node lokalny działa';
|
||||
|
||||
@override
|
||||
String get closeWalletNodeDialogBody =>
|
||||
'Czy chcesz pozostawić lokalny node uruchomiony po zamknięciu portfela?';
|
||||
|
||||
@override
|
||||
String get closeWalletKeepNodeAction => 'Zostaw node uruchomiony';
|
||||
|
||||
@override
|
||||
String get closeWalletStopNodeAction => 'Zatrzymaj node i zamknij portfel';
|
||||
|
||||
@override
|
||||
String get showSeedAction => 'Pokaż seed';
|
||||
|
||||
|
||||
@@ -171,6 +171,10 @@
|
||||
"settingsTitle": "Ustawienia",
|
||||
"walletSettingsTitle": "Portfel",
|
||||
"switchWalletAction": "Przełącz portfel",
|
||||
"closeWalletNodeDialogTitle": "Node lokalny działa",
|
||||
"closeWalletNodeDialogBody": "Czy chcesz pozostawić lokalny node uruchomiony po zamknięciu portfela?",
|
||||
"closeWalletKeepNodeAction": "Zostaw node uruchomiony",
|
||||
"closeWalletStopNodeAction": "Zatrzymaj node i zamknij portfel",
|
||||
"showSeedAction": "Pokaż seed",
|
||||
"copySeedAction": "Kopiuj seed",
|
||||
"copyAddressAction": "Kopiuj adres",
|
||||
|
||||
@@ -84,7 +84,7 @@ class AccountScreen extends ConsumerWidget {
|
||||
runSpacing: 12,
|
||||
children: [
|
||||
ElevatedButton.icon(
|
||||
onPressed: state.isSyncing
|
||||
onPressed: state.isLoading
|
||||
? null
|
||||
: () => ref.read(walletControllerProvider.notifier).syncNow(),
|
||||
icon: const Icon(Symbols.sync),
|
||||
@@ -124,7 +124,7 @@ class AccountScreen extends ConsumerWidget {
|
||||
|
||||
String _balanceLabel(BuildContext context, WalletState state) {
|
||||
final l10n = context.l10n;
|
||||
if (state.isSyncing || !state.syncStatus.synced) {
|
||||
if (state.syncStatus.lastSync == null) {
|
||||
return l10n.balanceLoading;
|
||||
}
|
||||
final amount = formatAtomicAmount(state.balanceAtomic);
|
||||
@@ -132,7 +132,7 @@ class AccountScreen extends ConsumerWidget {
|
||||
}
|
||||
|
||||
String _availableLabel(BuildContext context, WalletState state) {
|
||||
if (state.isSyncing || !state.syncStatus.synced) {
|
||||
if (state.syncStatus.lastSync == null) {
|
||||
return context.l10n.balanceLoading;
|
||||
}
|
||||
final amount = formatAtomicAmount(state.unlockedAtomic);
|
||||
@@ -140,7 +140,7 @@ class AccountScreen extends ConsumerWidget {
|
||||
}
|
||||
|
||||
String _lockedLabel(BuildContext context, WalletState state) {
|
||||
if (state.isSyncing || !state.syncStatus.synced) {
|
||||
if (state.syncStatus.lastSync == null) {
|
||||
return context.l10n.balanceLoading;
|
||||
}
|
||||
final lockedAtomic = state.balanceAtomic > state.unlockedAtomic
|
||||
|
||||
@@ -32,6 +32,53 @@ class SettingsScreen extends ConsumerWidget {
|
||||
title: Text(l10n.switchWalletAction),
|
||||
leading: const Icon(Symbols.swap_horiz),
|
||||
onTap: () async {
|
||||
final localNodeService = ref.read(localNodeServiceProvider);
|
||||
final shouldPromptForLocalNode = config.nodeConfig.mode == NodeMode.local &&
|
||||
await localNodeService.isRunning(
|
||||
config: LocalNodeConfig(extraArgs: config.localNodeArgs),
|
||||
);
|
||||
var shouldStopLocalNode = false;
|
||||
if (shouldPromptForLocalNode) {
|
||||
if (!context.mounted) {
|
||||
return;
|
||||
}
|
||||
final decision = await showDialog<bool?>(
|
||||
context: context,
|
||||
builder: (dialogContext) {
|
||||
return AlertDialog(
|
||||
title: Text(l10n.closeWalletNodeDialogTitle),
|
||||
content: Text(l10n.closeWalletNodeDialogBody),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(dialogContext).pop(null),
|
||||
child: Text(l10n.cancelAction),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(dialogContext).pop(false),
|
||||
child: Text(l10n.closeWalletKeepNodeAction),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () => Navigator.of(dialogContext).pop(true),
|
||||
child: Text(l10n.closeWalletStopNodeAction),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
if (decision == null) {
|
||||
return;
|
||||
}
|
||||
shouldStopLocalNode = decision;
|
||||
}
|
||||
if (shouldStopLocalNode) {
|
||||
final stopped = await localNodeService.stop();
|
||||
if (!stopped && context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(l10n.localNodeStopFailure)),
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
await ref.read(walletControllerProvider.notifier).switchWallet();
|
||||
await configController.setLastWallet(null);
|
||||
},
|
||||
|
||||
@@ -34,10 +34,26 @@ class WalletSetupScreen extends ConsumerWidget {
|
||||
_ErrorBanner(message: context.l10n.errorMessage(state.error!)),
|
||||
const SizedBox(height: 24),
|
||||
],
|
||||
Image.asset(
|
||||
'assets/logo.png',
|
||||
width: 132,
|
||||
height: 132,
|
||||
Container(
|
||||
width: 148,
|
||||
height: 148,
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0x180C1824),
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
border: Border.all(color: const Color(0x1F88FFE1)),
|
||||
),
|
||||
child: Image.asset(
|
||||
'assets/logo.png',
|
||||
fit: BoxFit.contain,
|
||||
filterQuality: FilterQuality.high,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return const Icon(
|
||||
Symbols.account_balance_wallet,
|
||||
size: 88,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 18),
|
||||
Text(
|
||||
|
||||
Reference in New Issue
Block a user