CAKE-222 | fixed transaction priority picker on the send page

OleksandrSobol committed Jan 6, 2021 at 10:42 UTC 68a39bdcfc65b1b8dc7fd0aea734b467c626c66c
3 files changed +11 -3
lib/src/screens/send/send_page.dart
+2 -1
@@ -746,6 +746,7 @@ class SendPage extends BasePage {
746 Future<void> _setTransactionPriority(BuildContext context) async {
747 final items = TransactionPriority.forWalletType(sendViewModel.walletType);
748 final selectedItem = items.indexOf(sendViewModel.transactionPriority);
749 + final isShowScrollThumb = items.length > 3;
750
751 await showPopUp<void>(
752 builder: (_) => Picker(
@@ -755,7 +756,7 @@ class SendPage extends BasePage {
756 mainAxisAlignment: MainAxisAlignment.center,
757 onItemSelected: (TransactionPriority priority) =>
758 sendViewModel.setTransactionPriority(priority),
758 - isAlwaysShowScrollThumb: true,
759 + isAlwaysShowScrollThumb: isShowScrollThumb,
760 ),
761 context: context);
762 }
lib/view_model/send/send_view_model.dart
+7
@@ -38,6 +38,13 @@ abstract class SendViewModelBase with Store {
38 : state = InitialExecutionState(),
39 _cryptoNumberFormat = NumberFormat(),
40 sendAll = false {
41 + final _priority = _settingsStore.transactionPriority;
42 +
43 + if (!TransactionPriority.forWalletType(walletType).contains(_priority)) {
44 + _settingsStore.transactionPriority =
45 + TransactionPriority.forWalletType(walletType).first;
46 + }
47 +
48 _setCryptoNumMaximumFractionDigits();
49 }
50
lib/view_model/settings/settings_view_model.dart
+2 -2
@@ -36,9 +36,9 @@ abstract class SettingsViewModelBase with Store {
36 PackageInfo.fromPlatform().then(
37 (PackageInfo packageInfo) => currentVersion = packageInfo.version);
38
39 - final priority = _settingsStore.transactionPriority;
39 + final _priority = _settingsStore.transactionPriority;
40
41 - if (!TransactionPriority.forWalletType(_walletType).contains(priority)) {
41 + if (!TransactionPriority.forWalletType(_walletType).contains(_priority)) {
42 _settingsStore.transactionPriority =
43 TransactionPriority.forWalletType(_walletType).first;
44 }