mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-23 11:04:33 +00:00
use isTestnet flag on coin enum
This commit is contained in:
parent
3bdb0a1984
commit
500fd9b94d
12 changed files with 16 additions and 28 deletions
|
@ -60,11 +60,9 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
|
|||
String _searchTerm = "";
|
||||
|
||||
final List<Coin> _coinsTestnet = [
|
||||
...Coin.values.sublist(Coin.values.length - kTestNetCoinCount - 1),
|
||||
];
|
||||
final List<Coin> _coins = [
|
||||
...Coin.values.sublist(0, Coin.values.length - kTestNetCoinCount - 1)
|
||||
...Coin.values.where((e) => e.isTestNet),
|
||||
];
|
||||
final List<Coin> _coins = [...Coin.values.where((e) => !e.isTestNet)];
|
||||
final List<AddWalletListEntity> coinEntities = [];
|
||||
final List<EthTokenEntity> tokenEntities = [];
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ class _AddressBookViewState extends ConsumerState<AddressBookView> {
|
|||
} else {
|
||||
ref
|
||||
.read(addressBookFilterProvider)
|
||||
.addAll(coins.getRange(0, coins.length - kTestNetCoinCount), false);
|
||||
.addAll(coins.where((e) => !e.isTestNet), false);
|
||||
}
|
||||
} else {
|
||||
ref.read(addressBookFilterProvider).add(widget.coin!, false);
|
||||
|
|
|
@ -47,10 +47,7 @@ class _AddressBookFilterViewState extends ConsumerState<AddressBookFilterView> {
|
|||
if (showTestNet) {
|
||||
_coins = coins.toList(growable: false);
|
||||
} else {
|
||||
_coins = coins
|
||||
.toList(growable: false)
|
||||
.getRange(0, coins.length - kTestNetCoinCount)
|
||||
.toList(growable: false);
|
||||
_coins = coins.where((e) => !e.isTestNet).toList(growable: false);
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ class CoinSelectSheet extends StatelessWidget {
|
|||
shrinkWrap: true,
|
||||
itemCount: showTestNet
|
||||
? coins_.length
|
||||
: coins_.length - kTestNetCoinCount,
|
||||
: coins_.where((e) => !e.isTestNet).length,
|
||||
itemBuilder: (builderContext, index) {
|
||||
final coin = coins_[index];
|
||||
return Padding(
|
||||
|
|
|
@ -96,7 +96,7 @@ class _NewContactAddressEntryFormState
|
|||
|
||||
coins.remove(Coin.firoTestNet);
|
||||
if (showTestNet) {
|
||||
coins = coins.sublist(0, coins.length - kTestNetCoinCount);
|
||||
coins = coins.where((e) => !e.isTestNet).toList();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,9 +45,8 @@ class ManageCoinUnitsView extends ConsumerWidget {
|
|||
|
||||
final _coins = Coin.values.where((e) => e != Coin.firoTestNet).toList();
|
||||
|
||||
List<Coin> coins = showTestNet
|
||||
? _coins
|
||||
: _coins.sublist(0, _coins.length - kTestNetCoinCount);
|
||||
List<Coin> coins =
|
||||
showTestNet ? _coins : _coins.where((e) => !e.isTestNet).toList();
|
||||
|
||||
return ConditionalParent(
|
||||
condition: Util.isDesktop,
|
||||
|
|
|
@ -56,9 +56,8 @@ class _ManageNodesViewState extends ConsumerState<ManageNodesView> {
|
|||
prefsChangeNotifierProvider.select((value) => value.showTestNetCoins),
|
||||
);
|
||||
|
||||
List<Coin> coins = showTestNet
|
||||
? _coins
|
||||
: _coins.sublist(0, _coins.length - kTestNetCoinCount);
|
||||
List<Coin> coins =
|
||||
showTestNet ? _coins : _coins.where((e) => !e.isTestNet).toList();
|
||||
|
||||
return Background(
|
||||
child: Scaffold(
|
||||
|
|
|
@ -103,7 +103,7 @@ class _DesktopAddressBook extends ConsumerState<DesktopAddressBook> {
|
|||
} else {
|
||||
ref
|
||||
.read(addressBookFilterProvider)
|
||||
.addAll(coins.getRange(0, coins.length - kTestNetCoinCount), false);
|
||||
.addAll(coins.where((e) => !e.isTestNet), false);
|
||||
}
|
||||
// } else {
|
||||
// ref.read(addressBookFilterProvider).add(widget.coin!, false);
|
||||
|
|
|
@ -40,7 +40,7 @@ class DesktopManageBlockExplorersDialog extends ConsumerWidget {
|
|||
|
||||
final List<Coin> coins = showTestNet
|
||||
? Coin.values
|
||||
: Coin.values.sublist(0, Coin.values.length - kTestNetCoinCount);
|
||||
: Coin.values.where((e) => !e.isTestNet).toList();
|
||||
|
||||
return DesktopDialog(
|
||||
maxHeight: 850,
|
||||
|
|
|
@ -97,9 +97,8 @@ class _NodesSettings extends ConsumerState<NodesSettings> {
|
|||
prefsChangeNotifierProvider.select((value) => value.showTestNetCoins),
|
||||
);
|
||||
|
||||
List<Coin> coins = showTestNet
|
||||
? _coins
|
||||
: _coins.sublist(0, _coins.length - kTestNetCoinCount);
|
||||
List<Coin> coins =
|
||||
showTestNet ? _coins : _coins.where((e) => !e.isTestNet).toList();
|
||||
|
||||
coins = _search(filter, coins);
|
||||
|
||||
|
|
|
@ -42,9 +42,6 @@ enum Coin {
|
|||
stellarTestnet,
|
||||
}
|
||||
|
||||
final int kTestNetCoinCount = 6; // Util.isDesktop ? 5 : 4;
|
||||
// remove firotestnet for now
|
||||
|
||||
extension CoinExt on Coin {
|
||||
String get prettyName {
|
||||
switch (this) {
|
||||
|
|
|
@ -70,9 +70,8 @@ class _ChooseCoinViewState extends ConsumerState<ChooseCoinView> {
|
|||
prefsChangeNotifierProvider.select((value) => value.showTestNetCoins),
|
||||
);
|
||||
|
||||
List<Coin> coins = showTestNet
|
||||
? _coins
|
||||
: _coins.sublist(0, _coins.length - kTestNetCoinCount);
|
||||
List<Coin> coins =
|
||||
showTestNet ? _coins : _coins.where((e) => !e.isTestNet).toList();
|
||||
|
||||
return Background(
|
||||
child: Scaffold(
|
||||
|
|
Loading…
Reference in a new issue