@@ -3,8 +3,10 @@ import 'dart:async';
33import 'package:flutter/foundation.dart' ;
44import 'package:flutter_riverpod/flutter_riverpod.dart' ;
55import 'package:isar/isar.dart' ;
6- import '../../../providers/db/main_db_provider.dart' ;
6+
77import '../../../app_config.dart' ;
8+ import '../../../providers/db/main_db_provider.dart' ;
9+ import '../../../providers/global/duress_provider.dart' ;
810import '../../crypto_currency/crypto_currency.dart' ;
911import '../models/wallet_info.dart' ;
1012
@@ -27,9 +29,9 @@ class _Watcher extends ChangeNotifier {
2729 .sortByFavouriteOrderIndex ()
2830 .watch (fireImmediately: true )
2931 .listen ((event) {
30- _value = event;
31- notifyListeners ();
32- });
32+ _value = event;
33+ notifyListeners ();
34+ });
3335 }
3436
3537 @override
@@ -39,32 +41,42 @@ class _Watcher extends ChangeNotifier {
3941 }
4042}
4143
42- final _wiProvider = ChangeNotifierProvider .family <_Watcher , bool >(
43- (ref, isFavourite) {
44- final isar = ref.watch (mainDBProvider).isar;
44+ final _wiProvider = ChangeNotifierProvider .family <_Watcher , bool >((
45+ ref,
46+ isFavourite,
47+ ) {
48+ final isar = ref.watch (mainDBProvider).isar;
49+
50+ final watcher = _Watcher (
51+ isar.walletInfo
52+ .filter ()
53+ .anyOf <String , CryptoCurrency >(
54+ AppConfig .coins.map ((e) => e.identifier),
55+ (q, element) => q.coinNameMatches (element),
56+ )
57+ .isFavouriteEqualTo (isFavourite)
58+ .sortByFavouriteOrderIndex ()
59+ .findAllSync (),
60+ isFavourite,
61+ isar,
62+ );
63+
64+ ref.onDispose (() => watcher.dispose ());
65+
66+ return watcher;
67+ });
4568
46- final watcher = _Watcher (
47- isar.walletInfo
48- .filter ()
49- .anyOf <String , CryptoCurrency >(
50- AppConfig .coins.map ((e) => e.identifier),
51- (q, element) => q.coinNameMatches (element),
52- )
53- .isFavouriteEqualTo (isFavourite)
54- .sortByFavouriteOrderIndex ()
55- .findAllSync (),
56- isFavourite,
57- isar,
58- );
69+ final pFavouriteWalletInfos = Provider .family <List <WalletInfo >, bool >((
70+ ref,
71+ isFavourite,
72+ ) {
73+ final isDuress = ref.watch (pDuress);
5974
60- ref.onDispose (() => watcher. dispose ()) ;
75+ final infos = ref.watch ( _wiProvider (isFavourite)).value ;
6176
62- return watcher;
63- },
64- );
77+ if (isDuress) {
78+ infos. retainWhere ((e) => e.isDuressVisible);
79+ }
6580
66- final pFavouriteWalletInfos = Provider .family <List <WalletInfo >, bool >(
67- (ref, isFavourite) {
68- return ref.watch (_wiProvider (isFavourite)).value;
69- },
70- );
81+ return infos;
82+ });
0 commit comments