Merge pull request #167 from cake-tech/CAKE-222-fix-fee-picker-on-the-settings-screen

Cake 222 fix fee picker on the settings screen
This commit is contained in:
M
2021-01-08 21:14:29 +02:00
7 changed files with 23 additions and 16 deletions
+7
View File
@@ -40,6 +40,13 @@ abstract class SendViewModelBase with Store {
_cryptoNumberFormat = NumberFormat(),
note = '',
sendAll = false {
final _priority = _settingsStore.transactionPriority;
if (!TransactionPriority.forWalletType(walletType).contains(_priority)) {
_settingsStore.transactionPriority =
TransactionPriority.forWalletType(walletType).first;
}
_setCryptoNumMaximumFractionDigits();
}
@@ -6,15 +6,13 @@ class PickerListItem<ItemType> extends SettingsListItem {
{@required String title,
@required this.selectedItem,
@required this.items,
void Function(ItemType item) onItemSelected,
this.isAlwaysShowScrollThumb = false})
void Function(ItemType item) onItemSelected})
: _onItemSelected = onItemSelected,
super(title);
final ItemType Function() selectedItem;
final List<ItemType> items;
final void Function(ItemType item) _onItemSelected;
final bool isAlwaysShowScrollThumb;
void onItemSelected(dynamic item) {
if (item is ItemType) {
@@ -35,6 +35,14 @@ abstract class SettingsViewModelBase with Store {
currentVersion = '';
PackageInfo.fromPlatform().then(
(PackageInfo packageInfo) => currentVersion = packageInfo.version);
final _priority = _settingsStore.transactionPriority;
if (!TransactionPriority.forWalletType(_walletType).contains(_priority)) {
_settingsStore.transactionPriority =
TransactionPriority.forWalletType(_walletType).first;
}
sections = [
[
if ((wallet.balance.availableModes as List).length > 1)
@@ -47,7 +55,6 @@ abstract class SettingsViewModelBase with Store {
PickerListItem(
title: S.current.settings_currency,
items: FiatCurrency.all,
isAlwaysShowScrollThumb: true,
selectedItem: () => fiatCurrency,
onItemSelected: (FiatCurrency currency) =>
setFiatCurrency(currency)),
@@ -55,7 +62,6 @@ abstract class SettingsViewModelBase with Store {
title: S.current.settings_fee_priority,
items: TransactionPriority.forWalletType(wallet.type),
selectedItem: () => transactionPriority,
isAlwaysShowScrollThumb: true,
onItemSelected: (TransactionPriority priority) =>
_settingsStore.transactionPriority = priority),
SwitcherListItem(