CAKE-222 | fixed transaction priority picker on the settings screen; added check of priority for wallet type

OleksandrSobol committed Jan 4, 2021 at 17:13 UTC 9b041dbe1ead0f66eb7bd51ccd5456888ace00f0
1 file changed +10 -1
lib/view_model/settings/settings_view_model.dart
+10 -1
@@ -35,6 +35,14 @@ abstract class SettingsViewModelBase with Store {
35 currentVersion = '';
36 PackageInfo.fromPlatform().then(
37 (PackageInfo packageInfo) => currentVersion = packageInfo.version);
38 +
39 + final priority = _settingsStore.transactionPriority;
40 +
41 + if (!TransactionPriority.forWalletType(_walletType).contains(priority)) {
42 + _settingsStore.transactionPriority =
43 + TransactionPriority.forWalletType(_walletType).first;
44 + }
45 +
46 sections = [
47 [
48 if ((wallet.balance.availableModes as List).length > 1)
@@ -55,7 +63,8 @@ abstract class SettingsViewModelBase with Store {
63 title: S.current.settings_fee_priority,
64 items: TransactionPriority.forWalletType(wallet.type),
65 selectedItem: () => transactionPriority,
58 - isAlwaysShowScrollThumb: true,
66 + isAlwaysShowScrollThumb:
67 + TransactionPriority.forWalletType(wallet.type).length > 3,
68 onItemSelected: (TransactionPriority priority) =>
69 _settingsStore.transactionPriority = priority),
70 SwitcherListItem(