@@ -13,6 +13,7 @@ import 'dart:async';
1313import 'package:flutter/material.dart' ;
1414import 'package:flutter/services.dart' ;
1515import 'package:flutter_riverpod/flutter_riverpod.dart' ;
16+
1617import '../../../../notifications/show_flush_bar.dart' ;
1718import '../../../../pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart' ;
1819import '../../../../providers/global/secure_store_provider.dart' ;
@@ -21,6 +22,7 @@ import '../../../../route_generator.dart';
2122import '../../../../themes/stack_colors.dart' ;
2223import '../../../../utilities/assets.dart' ;
2324import '../../../../utilities/clipboard_interface.dart' ;
25+ import '../../../../utilities/logger.dart' ;
2426import '../../../../utilities/text_styles.dart' ;
2527import '../../../../wallets/isar/providers/wallet_info_provider.dart' ;
2628import '../../../../widgets/desktop/desktop_dialog.dart' ;
@@ -52,6 +54,11 @@ class _DeleteWalletKeysPopup extends ConsumerState<DeleteWalletKeysPopup> {
5254 late final List <String > _words;
5355 late final ClipboardInterface _clipboardInterface;
5456
57+ static const _recoveryPhraseInfo =
58+ "Please write down your recovery phrase in the correct order and save it "
59+ "to keep your funds secure. "
60+ "You will be shown your recovery phrase on the next screen." ;
61+
5562 @override
5663 void initState () {
5764 _walletId = widget.walletId;
@@ -72,61 +79,45 @@ class _DeleteWalletKeysPopup extends ConsumerState<DeleteWalletKeysPopup> {
7279 mainAxisAlignment: MainAxisAlignment .spaceBetween,
7380 children: [
7481 Padding (
75- padding: const EdgeInsets .only (
76- left: 32 ,
77- ),
82+ padding: const EdgeInsets .only (left: 32 ),
7883 child: Text (
7984 "Wallet keys" ,
8085 style: STextStyles .desktopH3 (context),
8186 ),
8287 ),
8388 DesktopDialogCloseButton (
8489 onPressedOverride: () {
85- Navigator .of (
86- context,
87- rootNavigator: true ,
88- ).pop ();
90+ Navigator .of (context, rootNavigator: true ).pop ();
8991 },
9092 ),
9193 ],
9294 ),
93- const SizedBox (
94- height: 28 ,
95- ),
95+ const SizedBox (height: 28 ),
9696 Text (
9797 "Recovery phrase" ,
9898 style: STextStyles .desktopTextMedium (context),
9999 ),
100- const SizedBox (
101- height: 8 ,
102- ),
100+ const SizedBox (height: 8 ),
103101 Center (
104102 child: Padding (
105- padding: const EdgeInsets .symmetric (
106- horizontal: 32 ,
107- ),
103+ padding: const EdgeInsets .symmetric (horizontal: 32 ),
108104 child: Text (
109- "Please write down your recovery phrase in the correct order and "
110- "save it to keep your funds secure. You will be shown your recovery phrase on the next screen." ,
105+ _recoveryPhraseInfo,
111106 style: STextStyles .desktopTextExtraExtraSmall (context),
112107 textAlign: TextAlign .center,
113108 ),
114109 ),
115110 ),
116- const SizedBox (
117- height: 24 ,
118- ),
111+ const SizedBox (height: 24 ),
119112 Padding (
120- padding: const EdgeInsets .symmetric (
121- horizontal: 32 ,
122- ),
113+ padding: const EdgeInsets .symmetric (horizontal: 32 ),
123114 child: RawMaterialButton (
124115 hoverColor: Colors .transparent,
125116 onPressed: () async {
126117 await _clipboardInterface.setData (
127118 ClipboardData (text: _words.join (" " )),
128119 );
129- if (mounted) {
120+ if (context. mounted) {
130121 unawaited (
131122 showFloatingFlushBar (
132123 type: FlushBarType .info,
@@ -140,19 +131,15 @@ class _DeleteWalletKeysPopup extends ConsumerState<DeleteWalletKeysPopup> {
140131 child: MnemonicTable (
141132 words: widget.words,
142133 isDesktop: true ,
143- itemBorderColor: Theme .of (context)
144- . extension < StackColors > () !
145- .buttonBackSecondary,
134+ itemBorderColor: Theme .of (
135+ context,
136+ ). extension < StackColors > () ! .buttonBackSecondary,
146137 ),
147138 ),
148139 ),
149- const SizedBox (
150- height: 24 ,
151- ),
140+ const SizedBox (height: 24 ),
152141 Padding (
153- padding: const EdgeInsets .symmetric (
154- horizontal: 32 ,
155- ),
142+ padding: const EdgeInsets .symmetric (horizontal: 32 ),
156143 child: Row (
157144 children: [
158145 Expanded (
@@ -162,9 +149,7 @@ class _DeleteWalletKeysPopup extends ConsumerState<DeleteWalletKeysPopup> {
162149 await Navigator .of (context).push (
163150 RouteGenerator .getRoute (
164151 builder: (context) {
165- return ConfirmDelete (
166- walletId: _walletId,
167- );
152+ return ConfirmDelete (walletId: _walletId);
168153 },
169154 settings: const RouteSettings (
170155 name: "/desktopConfirmDelete" ,
@@ -177,20 +162,15 @@ class _DeleteWalletKeysPopup extends ConsumerState<DeleteWalletKeysPopup> {
177162 ],
178163 ),
179164 ),
180- const SizedBox (
181- height: 32 ,
182- ),
165+ const SizedBox (height: 32 ),
183166 ],
184167 ),
185168 );
186169 }
187170}
188171
189172class ConfirmDelete extends ConsumerStatefulWidget {
190- const ConfirmDelete ({
191- super .key,
192- required this .walletId,
193- });
173+ const ConfirmDelete ({super .key, required this .walletId});
194174
195175 final String walletId;
196176
@@ -207,9 +187,7 @@ class _ConfirmDeleteState extends ConsumerState<ConfirmDelete> {
207187 children: [
208188 const Row (
209189 mainAxisAlignment: MainAxisAlignment .end,
210- children: [
211- DesktopDialogCloseButton (),
212- ],
190+ children: [DesktopDialogCloseButton ()],
213191 ),
214192 Column (
215193 crossAxisAlignment: CrossAxisAlignment .center,
@@ -238,12 +216,22 @@ class _ConfirmDeleteState extends ConsumerState<ConfirmDelete> {
238216 buttonHeight: ButtonHeight .xl,
239217 label: "Continue" ,
240218 onPressed: () async {
241- await ref.read (pWallets).deleteWallet (
242- ref.read (pWalletInfo (widget.walletId)),
243- ref.read (secureStoreProvider),
244- );
219+ try {
220+ await ref
221+ .read (pWallets)
222+ .deleteWallet (
223+ ref.read (pWalletInfo (widget.walletId)),
224+ ref.read (secureStoreProvider),
225+ );
226+ } catch (e, s) {
227+ Logging .instance.f (
228+ "Wallet deletion errors" ,
229+ error: e,
230+ stackTrace: s,
231+ );
232+ }
245233
246- if (mounted) {
234+ if (context. mounted) {
247235 Navigator .of (context, rootNavigator: true ).pop (true );
248236 }
249237 },
0 commit comments