@@ -17,7 +17,6 @@ import '../../app_config.dart';
1717import '../../models/add_wallet_list_entity/sub_classes/coin_entity.dart' ;
1818import '../../models/isar/models/ethereum/eth_contract.dart' ;
1919import '../../pages_desktop_specific/my_stack_view/dialogs/desktop_expanding_wallet_card.dart' ;
20- import '../../providers/db/main_db_provider.dart' ;
2120import '../../providers/providers.dart' ;
2221import '../../services/event_bus/events/wallet_added_event.dart' ;
2322import '../../services/event_bus/global_event_bus.dart' ;
@@ -28,6 +27,7 @@ import '../../utilities/text_styles.dart';
2827import '../../utilities/util.dart' ;
2928import '../../wallets/crypto_currency/crypto_currency.dart' ;
3029import '../../wallets/isar/models/wallet_info.dart' ;
30+ import '../../wallets/isar/providers/all_wallets_info_provider.dart' ;
3131import '../../wallets/isar/providers/wallet_info_provider.dart' ;
3232import '../../wallets/wallet/wallet.dart' ;
3333import '../../widgets/background.dart' ;
@@ -73,13 +73,14 @@ class _EthWalletsOverviewState extends ConsumerState<WalletsOverview> {
7373
7474 List <WalletListItemData > _filter (String searchTerm) {
7575 // clean out deleted wallets
76- final existingWalletIds = ref
77- .read (mainDBProvider)
78- .isar
79- .walletInfo
80- .where ()
81- .walletIdProperty ()
82- .findAllSync ();
76+ final existingWalletIds =
77+ ref
78+ .read (mainDBProvider)
79+ .isar
80+ .walletInfo
81+ .where ()
82+ .walletIdProperty ()
83+ .findAllSync ();
8384 wallets.removeWhere ((k, v) => ! existingWalletIds.contains (k));
8485
8586 if (searchTerm.isEmpty) {
@@ -127,25 +128,22 @@ class _EthWalletsOverviewState extends ConsumerState<WalletsOverview> {
127128 }
128129
129130 void updateWallets () {
130- final walletsData =
131- ref. read (mainDBProvider).isar.walletInfo. where (). findAllSync ();
131+ final walletsData = ref. read (pAllWalletsInfo);
132+
132133 walletsData.removeWhere ((e) => e.coin != widget.coin);
133134
134135 if (widget.coin is Ethereum ) {
135136 for (final data in walletsData) {
136137 final List <EthContract > contracts = [];
137- final contractAddresses =
138- ref.read (pWalletTokenAddresses (data.walletId));
138+ final contractAddresses = ref.read (
139+ pWalletTokenAddresses (data.walletId),
140+ );
139141
140142 // fetch each contract
141143 for (final contractAddress in contractAddresses) {
142144 final contract = ref
143- .read (
144- mainDBProvider,
145- )
146- .getEthContractSync (
147- contractAddress,
148- );
145+ .read (mainDBProvider)
146+ .getEthContractSync (contractAddress);
149147
150148 // add it to list if it exists in DB
151149 if (contract != null ) {
@@ -155,9 +153,7 @@ class _EthWalletsOverviewState extends ConsumerState<WalletsOverview> {
155153
156154 // add tuple to list
157155 wallets[data.walletId] = (
158- wallet: ref.read (pWallets).getWallet (
159- data.walletId,
160- ),
156+ wallet: ref.read (pWallets).getWallet (data.walletId),
161157 contracts: contracts,
162158 );
163159 }
@@ -167,9 +163,7 @@ class _EthWalletsOverviewState extends ConsumerState<WalletsOverview> {
167163 // desktop single coin apps may cause issues so lets just ignore the error and move on
168164 try {
169165 wallets[data.walletId] = (
170- wallet: ref.read (pWallets).getWallet (
171- data.walletId,
172- ),
166+ wallet: ref.read (pWallets).getWallet (data.walletId),
173167 contracts: [],
174168 );
175169 } catch (_) {
@@ -211,46 +205,45 @@ class _EthWalletsOverviewState extends ConsumerState<WalletsOverview> {
211205 Widget build (BuildContext context) {
212206 return ConditionalParent (
213207 condition: ! isDesktop && ! AppConfig .isSingleCoinApp,
214- builder: (child) => Background (
215- child: Scaffold (
216- backgroundColor:
217- Theme .of (context).extension < StackColors > ()! .background,
218- appBar: AppBar (
219- leading: const AppBarBackButton (),
220- title: Text (
221- "${widget .coin .prettyName } (${widget .coin .ticker }) wallets" ,
222- style: STextStyles .navBarTitle (context),
223- ),
224- actions: [
225- AspectRatio (
226- aspectRatio: 1 ,
227- child: AppBarIconButton (
228- icon: SvgPicture .asset (
229- Assets .svg.plus,
230- width: 18 ,
231- height: 18 ,
232- color: Theme .of (context)
233- .extension < StackColors > ()!
234- .topNavIconPrimary,
235- ),
236- onPressed: () {
237- Navigator .of (context).pushNamed (
238- CreateOrRestoreWalletView .routeName,
239- arguments: CoinEntity (widget.coin),
240- );
241- },
208+ builder:
209+ (child) => Background (
210+ child: Scaffold (
211+ backgroundColor:
212+ Theme .of (context).extension < StackColors > ()! .background,
213+ appBar: AppBar (
214+ leading: const AppBarBackButton (),
215+ title: Text (
216+ "${widget .coin .prettyName } (${widget .coin .ticker }) wallets" ,
217+ style: STextStyles .navBarTitle (context),
242218 ),
219+ actions: [
220+ AspectRatio (
221+ aspectRatio: 1 ,
222+ child: AppBarIconButton (
223+ icon: SvgPicture .asset (
224+ Assets .svg.plus,
225+ width: 18 ,
226+ height: 18 ,
227+ color:
228+ Theme .of (
229+ context,
230+ ).extension < StackColors > ()! .topNavIconPrimary,
231+ ),
232+ onPressed: () {
233+ Navigator .of (context).pushNamed (
234+ CreateOrRestoreWalletView .routeName,
235+ arguments: CoinEntity (widget.coin),
236+ );
237+ },
238+ ),
239+ ),
240+ ],
241+ ),
242+ body: SafeArea (
243+ child: Padding (padding: const EdgeInsets .all (16 ), child: child),
243244 ),
244- ],
245- ),
246- body: SafeArea (
247- child: Padding (
248- padding: const EdgeInsets .all (16 ),
249- child: child,
250245 ),
251246 ),
252- ),
253- ),
254247 child: Column (
255248 children: [
256249 ClipRRect (
@@ -267,14 +260,16 @@ class _EthWalletsOverviewState extends ConsumerState<WalletsOverview> {
267260 _searchString = value;
268261 });
269262 },
270- style: isDesktop
271- ? STextStyles .desktopTextExtraSmall (context).copyWith (
272- color: Theme .of (context)
273- .extension < StackColors > ()!
274- .textFieldActiveText,
275- height: 1.8 ,
276- )
277- : STextStyles .field (context),
263+ style:
264+ isDesktop
265+ ? STextStyles .desktopTextExtraSmall (context).copyWith (
266+ color:
267+ Theme .of (
268+ context,
269+ ).extension < StackColors > ()! .textFieldActiveText,
270+ height: 1.8 ,
271+ )
272+ : STextStyles .field (context),
278273 decoration: standardInputDecoration (
279274 "Search..." ,
280275 searchFieldFocusNode,
@@ -292,32 +287,31 @@ class _EthWalletsOverviewState extends ConsumerState<WalletsOverview> {
292287 height: isDesktop ? 20 : 16 ,
293288 ),
294289 ),
295- suffixIcon: _searchController.text.isNotEmpty
296- ? Padding (
297- padding: const EdgeInsets .only (right: 0 ),
298- child: UnconstrainedBox (
299- child: Row (
300- children: [
301- TextFieldIconButton (
302- child: const XIcon (),
303- onTap: () async {
304- setState (() {
305- _searchController.text = "" ;
306- _searchString = "" ;
307- });
308- },
309- ),
310- ],
290+ suffixIcon:
291+ _searchController.text.isNotEmpty
292+ ? Padding (
293+ padding: const EdgeInsets .only (right: 0 ),
294+ child: UnconstrainedBox (
295+ child: Row (
296+ children: [
297+ TextFieldIconButton (
298+ child: const XIcon (),
299+ onTap: () async {
300+ setState (() {
301+ _searchController.text = "" ;
302+ _searchString = "" ;
303+ });
304+ },
305+ ),
306+ ],
307+ ),
311308 ),
312- ),
313- )
314- : null ,
309+ )
310+ : null ,
315311 ),
316312 ),
317313 ),
318- const SizedBox (
319- height: 16 ,
320- ),
314+ const SizedBox (height: 16 ),
321315 Expanded (
322316 child: Builder (
323317 builder: (context) {
@@ -346,33 +340,34 @@ class _EthWalletsOverviewState extends ConsumerState<WalletsOverview> {
346340 return ConditionalParent (
347341 key: Key (wallet.walletId),
348342 condition: isDesktop,
349- builder: (child) => RoundedWhiteContainer (
350- padding: const EdgeInsets .symmetric (
351- vertical: 14 ,
352- horizontal: 20 ,
353- ),
354- borderColor: Theme .of (context)
355- .extension < StackColors > ()!
356- .backgroundAppBar,
357- child: child,
358- ),
343+ builder:
344+ (child) => RoundedWhiteContainer (
345+ padding: const EdgeInsets .symmetric (
346+ vertical: 14 ,
347+ horizontal: 20 ,
348+ ),
349+ borderColor:
350+ Theme .of (
351+ context,
352+ ).extension < StackColors > ()! .backgroundAppBar,
353+ child: child,
354+ ),
359355 child: SimpleWalletCard (
360356 walletId: wallet.walletId,
361- popPrevious: widget
362- .overrideSimpleWalletCardPopPreviousValueWith ==
363- null
364- ? isDesktop
365- : widget
366- .overrideSimpleWalletCardPopPreviousValueWith! ,
357+ popPrevious:
358+ widget .overrideSimpleWalletCardPopPreviousValueWith ==
359+ null
360+ ? isDesktop
361+ : widget
362+ .overrideSimpleWalletCardPopPreviousValueWith! ,
367363 desktopNavigatorState:
368364 isDesktop ? widget.navigatorState : null ,
369365 ),
370366 );
371367 }
372368 },
373- separatorBuilder: (_, __) => SizedBox (
374- height: isDesktop ? 10 : 8 ,
375- ),
369+ separatorBuilder:
370+ (_, __) => SizedBox (height: isDesktop ? 10 : 8 ),
376371 itemCount: data.length,
377372 );
378373 },
0 commit comments