[skip ci] change fiat api UI to swich mode

This commit is contained in:
Serhii 2022-12-07 15:31:33 +02:00
parent 228e157b39
commit 37ca795756
2 changed files with 14 additions and 9 deletions

View file

@ -24,14 +24,12 @@ class PrivacyPage extends BasePage {
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
SettingsChoicesCell( SettingsSwitcherCell(
ChoicesListItem<FiatApiMode>(
title: S.current.fiat_api, title: S.current.fiat_api,
items: FiatApiMode.all, value: _privacySettingsViewModel.fiatApiMode,
selectedItem: _privacySettingsViewModel.fiatApiMode, onValueChange: (BuildContext context, bool value) {
onItemSelected: (FiatApiMode mode) => _privacySettingsViewModel.setFiatMode(mode), _privacySettingsViewModel.setFiatMode(value);
), }),
),
SettingsSwitcherCell( SettingsSwitcherCell(
title: S.current.disable_exchange, title: S.current.disable_exchange,
value: _privacySettingsViewModel.disableExchange, value: _privacySettingsViewModel.disableExchange,

View file

@ -18,7 +18,7 @@ abstract class PrivacySettingsViewModelBase with Store {
bool get shouldSaveRecipientAddress => _settingsStore.shouldSaveRecipientAddress; bool get shouldSaveRecipientAddress => _settingsStore.shouldSaveRecipientAddress;
@computed @computed
FiatApiMode get fiatApiMode => _settingsStore.fiatApiMode; bool get fiatApiMode => _settingsStore.fiatApiMode == FiatApiMode.disabled;
@action @action
void setShouldSaveRecipientAddress(bool value) => _settingsStore.shouldSaveRecipientAddress = value; void setShouldSaveRecipientAddress(bool value) => _settingsStore.shouldSaveRecipientAddress = value;
@ -27,5 +27,12 @@ abstract class PrivacySettingsViewModelBase with Store {
void setEnableExchange(bool value) => _settingsStore.disableExchange = value; void setEnableExchange(bool value) => _settingsStore.disableExchange = value;
@action @action
void setFiatMode(FiatApiMode mode) => _settingsStore.fiatApiMode = mode; void setFiatMode(bool value) {
if (value) {
_settingsStore.fiatApiMode = FiatApiMode.disabled;
return;
}
_settingsStore.fiatApiMode = FiatApiMode.enabled;
}
} }