Merge pull request #112 from cake-tech/CAKE-79-add-ability-to-flip-balance-on-the-main-screen

Cake 79 add ability to flip balance on the main screen
This commit is contained in:
M
2020-10-01 19:47:03 +03:00
15 changed files with 133 additions and 107 deletions
@@ -1,5 +1,4 @@
import 'package:cake_wallet/bitcoin/bitcoin_wallet.dart';
import 'package:cake_wallet/core/wallet_base.dart';
import 'package:cake_wallet/entities/crypto_currency.dart';
import 'package:cake_wallet/monero/monero_wallet.dart';
import 'package:cake_wallet/entities/balance_display_mode.dart';
@@ -20,19 +19,31 @@ abstract class BalanceViewModelBase with Store {
@required this.appStore,
@required this.settingsStore,
@required this.fiatConvertationStore
});
}) : isReversing = false;
final AppStore appStore;
final SettingsStore settingsStore;
final FiatConversionStore fiatConvertationStore;
@observable
bool isReversing;
@computed
BalanceDisplayMode get savedDisplayMode => settingsStore.balanceDisplayMode;
@computed
BalanceDisplayMode get displayMode => isReversing
? (savedDisplayMode == BalanceDisplayMode.availableBalance
? BalanceDisplayMode.fullBalance
: BalanceDisplayMode.availableBalance)
: savedDisplayMode;
@computed
double get price => fiatConvertationStore.price;
@computed
String get cryptoBalance {
final walletBalance = _walletBalance;
final displayMode = settingsStore.balanceDisplayMode;
var balance = '---';
if (displayMode == BalanceDisplayMode.availableBalance) {
@@ -49,7 +60,6 @@ abstract class BalanceViewModelBase with Store {
@computed
String get fiatBalance {
final walletBalance = _walletBalance;
final displayMode = settingsStore.balanceDisplayMode;
final fiatCurrency = settingsStore.fiatCurrency;
var balance = '---';