mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-01 12:04:21 +01:00
CAKE-79 | added ability to flip balance on dashboard page; added isReversing, displayMode and savedDisplayMode to balance_view_model; added display mode to balance page
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
|
||||
class BalancePage extends StatelessWidget {
|
||||
BalancePage({@required this.dashboardViewModel});
|
||||
@@ -11,42 +12,57 @@ class BalancePage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Observer(builder: (_) {
|
||||
return Text(
|
||||
dashboardViewModel.balanceViewModel.currency.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).indicatorColor,
|
||||
height: 1),
|
||||
);
|
||||
}),
|
||||
SizedBox(height: 10),
|
||||
Observer(builder: (_) {
|
||||
return Text(dashboardViewModel.balanceViewModel.cryptoBalance,
|
||||
child: GestureDetector(
|
||||
onTapUp: (_) => dashboardViewModel.balanceViewModel.isReversing = false,
|
||||
onTapDown: (_) => dashboardViewModel.balanceViewModel.isReversing = true,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Observer(builder: (_) {
|
||||
return Text(
|
||||
dashboardViewModel.balanceViewModel.currency.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 54,
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
height: 1),
|
||||
textAlign: TextAlign.center);
|
||||
}),
|
||||
SizedBox(height: 10),
|
||||
Observer(builder: (_) {
|
||||
return Text(dashboardViewModel.balanceViewModel.fiatBalance,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).indicatorColor,
|
||||
height: 1),
|
||||
textAlign: TextAlign.center);
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
Observer(builder: (_) {
|
||||
return Text(
|
||||
dashboardViewModel.balanceViewModel.displayMode.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).indicatorColor,
|
||||
height: 1),
|
||||
);
|
||||
}),
|
||||
SizedBox(height: 10),
|
||||
Observer(builder: (_) {
|
||||
return AutoSizeText(dashboardViewModel.balanceViewModel.cryptoBalance,
|
||||
style: TextStyle(
|
||||
fontSize: 54,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
height: 1),
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center);
|
||||
}),
|
||||
SizedBox(height: 10),
|
||||
Observer(builder: (_) {
|
||||
return Text(dashboardViewModel.balanceViewModel.fiatBalance,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).indicatorColor,
|
||||
height: 1),
|
||||
textAlign: TextAlign.center);
|
||||
}),
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ Future<T> showPopUp<T>({
|
||||
context: context,
|
||||
builder: builder,
|
||||
barrierDismissible: barrierDismissible,
|
||||
barrierColor: barrierColor,
|
||||
useSafeArea: useSafeArea,
|
||||
//barrierColor: barrierColor,
|
||||
//useSafeArea: useSafeArea,
|
||||
useRootNavigator: useRootNavigator,
|
||||
routeSettings: routeSettings,
|
||||
child: child);
|
||||
|
||||
@@ -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 = '---';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user