diff --git a/lib/src/screens/new_wallet/advanced_privacy_settings_page.dart b/lib/src/screens/new_wallet/advanced_privacy_settings_page.dart index a82ddaf4e..05ff65889 100644 --- a/lib/src/screens/new_wallet/advanced_privacy_settings_page.dart +++ b/lib/src/screens/new_wallet/advanced_privacy_settings_page.dart @@ -52,39 +52,37 @@ class _AdvancedPrivacySettingsBodyState extends State( title: S.current.disable_fiat, - value: widget.privacySettingsViewModel.fiatApi == FiatApiMode.disabled, - onValueChange: (BuildContext context, bool value) { - widget.privacySettingsViewModel.setFiatMode(value); - }); - } - ), - Observer( - builder: (_) { - return SettingsChoicesCell( - ChoicesListItem( - title: S.current.exchange, - items: ExchangeApiMode.all, - selectedItem: widget.privacySettingsViewModel.exchangeStatus, - onItemSelected: (ExchangeApiMode mode) => - widget.privacySettingsViewModel.setExchangeApiMode(mode), + items: FiatApiMode.all, + selectedItem: widget.privacySettingsViewModel.fiatApiMode, + onItemSelected: (FiatApiMode mode) => + widget.privacySettingsViewModel.setFiatApiMode(mode), + ), + ); + }), + Observer(builder: (_) { + return SettingsChoicesCell( + ChoicesListItem( + title: S.current.exchange, + items: ExchangeApiMode.all, + selectedItem: widget.privacySettingsViewModel.exchangeStatus, + onItemSelected: (ExchangeApiMode mode) => + widget.privacySettingsViewModel.setExchangeApiMode(mode), + ), + ); + }), + Observer(builder: (_) { + return Column( + children: [ + SettingsSwitcherCell( + title: S.current.add_custom_node, + value: widget.privacySettingsViewModel.addCustomNode, + onValueChange: (_, __) => widget.privacySettingsViewModel.toggleAddCustomNode(), ), - ); - } - ), - Observer( - builder: (_) { - return Column( - children: [ - SettingsSwitcherCell( - title: S.current.add_custom_node, - value: widget.privacySettingsViewModel.addCustomNode, - onValueChange: (_, __) => widget.privacySettingsViewModel.toggleAddCustomNode(), - ), - if (widget.privacySettingsViewModel.addCustomNode) + if (widget.privacySettingsViewModel.addCustomNode) Padding( padding: EdgeInsets.only(left: 24, right: 24, top: 24), child: NodeForm( @@ -92,11 +90,9 @@ class _AdvancedPrivacySettingsBodyState extends State _settingsStore.exchangeStatus; @computed - FiatApiMode get fiatApi => _settingsStore.fiatApiMode; + FiatApiMode get fiatApiMode => _settingsStore.fiatApiMode; @observable bool _addCustomNode = false; @@ -29,21 +29,11 @@ abstract class AdvancedPrivacySettingsViewModelBase with Store { bool get addCustomNode => _addCustomNode; @action - void setFiatMode(bool value) { - if (value) { - _settingsStore.fiatApiMode = FiatApiMode.disabled; - return; - } - _settingsStore.fiatApiMode = FiatApiMode.enabled; - } + void setFiatApiMode(FiatApiMode fiatApiMode) => _settingsStore.fiatApiMode = fiatApiMode; @action - void setExchangeApiMode(ExchangeApiMode value) { - _settingsStore.exchangeStatus = value; - } + void setExchangeApiMode(ExchangeApiMode value) => _settingsStore.exchangeStatus = value; @action - void toggleAddCustomNode() { - _addCustomNode = !_addCustomNode; - } + void toggleAddCustomNode() => _addCustomNode = !_addCustomNode; }