mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 01:37:40 +00:00
Add Fiat API mode to advanced privacy settings page
This commit is contained in:
parent
8625e33537
commit
de62987338
2 changed files with 36 additions and 50 deletions
|
@ -52,39 +52,37 @@ class _AdvancedPrivacySettingsBodyState extends State<AdvancedPrivacySettingsBod
|
|||
content: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Observer(
|
||||
builder: (_) {
|
||||
return SettingsSwitcherCell(
|
||||
Observer(builder: (_) {
|
||||
return SettingsChoicesCell(
|
||||
ChoicesListItem<FiatApiMode>(
|
||||
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<ExchangeApiMode>(
|
||||
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<ExchangeApiMode>(
|
||||
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<AdvancedPrivacySettingsBod
|
|||
nodeViewModel: widget.nodeViewModel,
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
),
|
||||
|
||||
],
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
bottomSectionPadding: EdgeInsets.all(24),
|
||||
|
|
|
@ -16,7 +16,7 @@ abstract class AdvancedPrivacySettingsViewModelBase with Store {
|
|||
ExchangeApiMode get exchangeStatus => _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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue