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

View file

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

View file

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