From 03748d680ad7eedce158962581cfd17cd57bed8b Mon Sep 17 00:00:00 2001 From: Godwin Asuquo Date: Thu, 1 Dec 2022 21:21:51 +0200 Subject: [PATCH] [skip ci] format files --- lib/src/screens/settings/privacy_page.dart | 36 +++++++++---------- .../settings/display_settings_view_model.dart | 30 +++++++--------- .../settings/other_settings_view_model.dart | 36 ++++++++----------- .../settings/privacy_settings_view_model.dart | 16 ++++----- .../security_settings_view_model.dart | 20 +++++------ 5 files changed, 58 insertions(+), 80 deletions(-) diff --git a/lib/src/screens/settings/privacy_page.dart b/lib/src/screens/settings/privacy_page.dart index 47041b4fb..128d864f4 100644 --- a/lib/src/screens/settings/privacy_page.dart +++ b/lib/src/screens/settings/privacy_page.dart @@ -19,24 +19,24 @@ class PrivacyPage extends BasePage { padding: EdgeInsets.only(top: 10), child: Observer(builder: (_) { return Observer(builder: (_) { - return Column( - mainAxisSize: MainAxisSize.min, - children: [ - SettingsSwitcherCell( - title: S.current.disable_exchange, - value: _privacySettingsViewModel.disableExchange, - onValueChange: (BuildContext context, bool value) { - _privacySettingsViewModel.setEnableExchange(value); - }), - SettingsSwitcherCell( - title: S.current.settings_save_recipient_address, - value: _privacySettingsViewModel.shouldSaveRecipientAddress, - onValueChange: (BuildContext _, bool value) { - _privacySettingsViewModel.setShouldSaveRecipientAddress(value); - }) - ], - ); - }); + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + SettingsSwitcherCell( + title: S.current.disable_exchange, + value: _privacySettingsViewModel.disableExchange, + onValueChange: (BuildContext context, bool value) { + _privacySettingsViewModel.setEnableExchange(value); + }), + SettingsSwitcherCell( + title: S.current.settings_save_recipient_address, + value: _privacySettingsViewModel.shouldSaveRecipientAddress, + onValueChange: (BuildContext _, bool value) { + _privacySettingsViewModel.setShouldSaveRecipientAddress(value); + }) + ], + ); + }); }), ); } diff --git a/lib/view_model/settings/display_settings_view_model.dart b/lib/view_model/settings/display_settings_view_model.dart index 3537dfa6e..4e73b3399 100644 --- a/lib/view_model/settings/display_settings_view_model.dart +++ b/lib/view_model/settings/display_settings_view_model.dart @@ -8,10 +8,9 @@ part 'display_settings_view_model.g.dart'; class DisplaySettingsViewModel = DisplaySettingsViewModelBase with _$DisplaySettingsViewModel; - abstract class DisplaySettingsViewModelBase with Store { DisplaySettingsViewModelBase( - this._settingsStore, + this._settingsStore, ); final SettingsStore _settingsStore; @@ -22,10 +21,8 @@ abstract class DisplaySettingsViewModelBase with Store { @computed String get languageCode => _settingsStore.languageCode; - @computed - BalanceDisplayMode get balanceDisplayMode => - _settingsStore.balanceDisplayMode; + BalanceDisplayMode get balanceDisplayMode => _settingsStore.balanceDisplayMode; @computed bool get shouldDisplayBalance => balanceDisplayMode == BalanceDisplayMode.displayableBalance; @@ -34,30 +31,27 @@ abstract class DisplaySettingsViewModelBase with Store { ThemeBase get theme => _settingsStore.currentTheme; @action - void setBalanceDisplayMode(BalanceDisplayMode value) => - _settingsStore.balanceDisplayMode = value; + void setBalanceDisplayMode(BalanceDisplayMode value) => _settingsStore.balanceDisplayMode = value; @action - void setShouldDisplayBalance(bool value){ - if (value) { - _settingsStore.balanceDisplayMode = BalanceDisplayMode.displayableBalance; + void setShouldDisplayBalance(bool value) { + if (value) { + _settingsStore.balanceDisplayMode = BalanceDisplayMode.displayableBalance; } else { - _settingsStore.balanceDisplayMode = BalanceDisplayMode.hiddenBalance; + _settingsStore.balanceDisplayMode = BalanceDisplayMode.hiddenBalance; } } @action - void onLanguageSelected (String code) { + void onLanguageSelected(String code) { _settingsStore.languageCode = code; } @action - void setTheme(ThemeBase newTheme){ - _settingsStore.currentTheme = newTheme; + void setTheme(ThemeBase newTheme) { + _settingsStore.currentTheme = newTheme; } @action - void setFiatCurrency(FiatCurrency value) => - _settingsStore.fiatCurrency = value; - -} \ No newline at end of file + void setFiatCurrency(FiatCurrency value) => _settingsStore.fiatCurrency = value; +} diff --git a/lib/view_model/settings/other_settings_view_model.dart b/lib/view_model/settings/other_settings_view_model.dart index b0ba4c9b5..b964adc6e 100644 --- a/lib/view_model/settings/other_settings_view_model.dart +++ b/lib/view_model/settings/other_settings_view_model.dart @@ -12,32 +12,26 @@ import 'package:package_info/package_info.dart'; part 'other_settings_view_model.g.dart'; -class OtherSettingsViewModel = OtherSettingsViewModelBase - with _$OtherSettingsViewModel; - +class OtherSettingsViewModel = OtherSettingsViewModelBase with _$OtherSettingsViewModel; abstract class OtherSettingsViewModelBase with Store { - OtherSettingsViewModelBase(this._settingsStore, WalletBase, - TransactionInfo> - wallet): - walletType = wallet.type, - _wallet = wallet, - currentVersion = ''{ - PackageInfo.fromPlatform().then( - (PackageInfo packageInfo) => currentVersion = packageInfo.version); + OtherSettingsViewModelBase( + this._settingsStore, WalletBase, TransactionInfo> wallet) + : walletType = wallet.type, + _wallet = wallet, + currentVersion = '' { + PackageInfo.fromPlatform().then((PackageInfo packageInfo) => currentVersion = packageInfo.version); final priority = _settingsStore.priority[wallet.type]; final priorities = priorityForWalletType(wallet.type); if (!priorities.contains(priority)) { _settingsStore.priority[wallet.type] = priorities.first; + } } - } - - final WalletType walletType; - final WalletBase, - TransactionInfo> _wallet; + final WalletType walletType; + final WalletBase, TransactionInfo> _wallet; @observable String currentVersion; @@ -55,11 +49,10 @@ abstract class OtherSettingsViewModelBase with Store { return priority; } - String getDisplayPriority(dynamic priority) { + String getDisplayPriority(dynamic priority) { final _priority = priority as TransactionPriority; - if (_wallet.type == WalletType.bitcoin - || _wallet.type == WalletType.litecoin) { + if (_wallet.type == WalletType.bitcoin || _wallet.type == WalletType.litecoin) { final rate = bitcoin!.getFeeRate(_wallet, _priority); return bitcoin!.bitcoinTransactionPriorityWithLabel(_priority, rate); } @@ -67,6 +60,5 @@ abstract class OtherSettingsViewModelBase with Store { return priority.toString(); } - void onDisplayPrioritySelected(TransactionPriority priority) => - _settingsStore.priority[_wallet.type] = priority; -} \ No newline at end of file + void onDisplayPrioritySelected(TransactionPriority priority) => _settingsStore.priority[_wallet.type] = priority; +} diff --git a/lib/view_model/settings/privacy_settings_view_model.dart b/lib/view_model/settings/privacy_settings_view_model.dart index 8433e673a..88311bf1f 100644 --- a/lib/view_model/settings/privacy_settings_view_model.dart +++ b/lib/view_model/settings/privacy_settings_view_model.dart @@ -3,8 +3,7 @@ import 'package:mobx/mobx.dart'; part 'privacy_settings_view_model.g.dart'; -class PrivacySettingsViewModel = PrivacySettingsViewModelBase - with _$PrivacySettingsViewModel; +class PrivacySettingsViewModel = PrivacySettingsViewModelBase with _$PrivacySettingsViewModel; abstract class PrivacySettingsViewModelBase with Store { PrivacySettingsViewModelBase(this._settingsStore); @@ -15,14 +14,11 @@ abstract class PrivacySettingsViewModelBase with Store { bool get disableExchange => _settingsStore.disableExchange; @computed - bool get shouldSaveRecipientAddress => - _settingsStore.shouldSaveRecipientAddress; + bool get shouldSaveRecipientAddress => _settingsStore.shouldSaveRecipientAddress; @action - void setShouldSaveRecipientAddress(bool value) => - _settingsStore.shouldSaveRecipientAddress = value; - + void setShouldSaveRecipientAddress(bool value) => _settingsStore.shouldSaveRecipientAddress = value; + @action - void setEnableExchange(bool value) => - _settingsStore.disableExchange = value; -} \ No newline at end of file + void setEnableExchange(bool value) => _settingsStore.disableExchange = value; +} diff --git a/lib/view_model/settings/security_settings_view_model.dart b/lib/view_model/settings/security_settings_view_model.dart index 9bf2fb6eb..4a88b633f 100644 --- a/lib/view_model/settings/security_settings_view_model.dart +++ b/lib/view_model/settings/security_settings_view_model.dart @@ -4,26 +4,22 @@ import 'package:mobx/mobx.dart'; part 'security_settings_view_model.g.dart'; -class SecuritySettingsViewModel = SecuritySettingsViewModelBase - with _$SecuritySettingsViewModel; +class SecuritySettingsViewModel = SecuritySettingsViewModelBase with _$SecuritySettingsViewModel; abstract class SecuritySettingsViewModelBase with Store { - SecuritySettingsViewModelBase(this._settingsStore): _biometricAuth = BiometricAuth(); + SecuritySettingsViewModelBase(this._settingsStore) : _biometricAuth = BiometricAuth(); final BiometricAuth _biometricAuth; final SettingsStore _settingsStore; - + @computed - bool get allowBiometricalAuthentication => - _settingsStore.allowBiometricalAuthentication; + bool get allowBiometricalAuthentication => _settingsStore.allowBiometricalAuthentication; @action - Future biometricAuthenticated()async{ - return await _biometricAuth.canCheckBiometrics() && await _biometricAuth.isAuthenticated(); + Future biometricAuthenticated() async { + return await _biometricAuth.canCheckBiometrics() && await _biometricAuth.isAuthenticated(); } @action - void setAllowBiometricalAuthentication(bool value) => - _settingsStore.allowBiometricalAuthentication = value; - -} \ No newline at end of file + void setAllowBiometricalAuthentication(bool value) => _settingsStore.allowBiometricalAuthentication = value; +}