addressbook filter coins list fix

This commit is contained in:
julian 2022-11-18 10:22:34 -06:00
parent d4b7ec0f17
commit 4d17c1db5f
3 changed files with 9 additions and 8 deletions

View file

@ -51,8 +51,7 @@ class _AddressBookViewState extends ConsumerState<AddressBookView> {
ref.refresh(addressBookFilterProvider);
if (widget.coin == null) {
List<Coin> coins =
Coin.values.where((e) => !(e == Coin.epicCash)).toList();
List<Coin> coins = Coin.values.toList();
coins.remove(Coin.firoTestNet);
bool showTestNet = ref.read(prefsChangeNotifierProvider).showTestNetCoins;
@ -60,8 +59,9 @@ class _AddressBookViewState extends ConsumerState<AddressBookView> {
if (showTestNet) {
ref.read(addressBookFilterProvider).addAll(coins, false);
} else {
ref.read(addressBookFilterProvider).addAll(
coins.getRange(0, coins.length - kTestNetCoinCount + 1), false);
ref
.read(addressBookFilterProvider)
.addAll(coins.getRange(0, coins.length - kTestNetCoinCount), false);
}
} else {
ref.read(addressBookFilterProvider).add(widget.coin!, false);

View file

@ -38,7 +38,7 @@ class _AddressBookFilterViewState extends ConsumerState<AddressBookFilterView> {
} else {
_coins = coins
.toList(growable: false)
.getRange(0, coins.length - kTestNetCoinCount + 1)
.getRange(0, coins.length - kTestNetCoinCount)
.toList(growable: false);
}
super.initState();

View file

@ -84,7 +84,7 @@ class _DesktopAddressBook extends ConsumerState<DesktopAddressBook> {
ref.refresh(addressBookFilterProvider);
// if (widget.coin == null) {
List<Coin> coins = Coin.values.where((e) => !(e == Coin.epicCash)).toList();
List<Coin> coins = Coin.values.toList();
coins.remove(Coin.firoTestNet);
bool showTestNet = ref.read(prefsChangeNotifierProvider).showTestNetCoins;
@ -92,8 +92,9 @@ class _DesktopAddressBook extends ConsumerState<DesktopAddressBook> {
if (showTestNet) {
ref.read(addressBookFilterProvider).addAll(coins, false);
} else {
ref.read(addressBookFilterProvider).addAll(
coins.getRange(0, coins.length - kTestNetCoinCount + 1), false);
ref
.read(addressBookFilterProvider)
.addAll(coins.getRange(0, coins.length - kTestNetCoinCount), false);
}
// } else {
// ref.read(addressBookFilterProvider).add(widget.coin!, false);