From 68a39bdcfc65b1b8dc7fd0aea734b467c626c66c Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Wed, 6 Jan 2021 10:42:21 +0200 Subject: [PATCH] CAKE-222 | fixed transaction priority picker on the send page --- lib/src/screens/send/send_page.dart | 3 ++- lib/view_model/send/send_view_model.dart | 7 +++++++ lib/view_model/settings/settings_view_model.dart | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index 1a18b5ba6..c4a350d82 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -746,6 +746,7 @@ class SendPage extends BasePage { Future _setTransactionPriority(BuildContext context) async { final items = TransactionPriority.forWalletType(sendViewModel.walletType); final selectedItem = items.indexOf(sendViewModel.transactionPriority); + final isShowScrollThumb = items.length > 3; await showPopUp( builder: (_) => Picker( @@ -755,7 +756,7 @@ class SendPage extends BasePage { mainAxisAlignment: MainAxisAlignment.center, onItemSelected: (TransactionPriority priority) => sendViewModel.setTransactionPriority(priority), - isAlwaysShowScrollThumb: true, + isAlwaysShowScrollThumb: isShowScrollThumb, ), context: context); } diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index f3d46ccb3..6b04de21c 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -38,6 +38,13 @@ abstract class SendViewModelBase with Store { : state = InitialExecutionState(), _cryptoNumberFormat = NumberFormat(), sendAll = false { + final _priority = _settingsStore.transactionPriority; + + if (!TransactionPriority.forWalletType(walletType).contains(_priority)) { + _settingsStore.transactionPriority = + TransactionPriority.forWalletType(walletType).first; + } + _setCryptoNumMaximumFractionDigits(); } diff --git a/lib/view_model/settings/settings_view_model.dart b/lib/view_model/settings/settings_view_model.dart index 4f43d528a..49ae9557f 100644 --- a/lib/view_model/settings/settings_view_model.dart +++ b/lib/view_model/settings/settings_view_model.dart @@ -36,9 +36,9 @@ abstract class SettingsViewModelBase with Store { PackageInfo.fromPlatform().then( (PackageInfo packageInfo) => currentVersion = packageInfo.version); - final priority = _settingsStore.transactionPriority; + final _priority = _settingsStore.transactionPriority; - if (!TransactionPriority.forWalletType(_walletType).contains(priority)) { + if (!TransactionPriority.forWalletType(_walletType).contains(_priority)) { _settingsStore.transactionPriority = TransactionPriority.forWalletType(_walletType).first; }