mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 01:37:40 +00:00
Merge pull request #104 from cake-tech/CAKE-288-hidden-balance-fixes
Cake 288 hidden balance fixes
This commit is contained in:
commit
c3fb0cfcd4
7 changed files with 120 additions and 107 deletions
|
@ -10,100 +10,108 @@ class BalancePage extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return GestureDetector(
|
||||||
color: Colors.transparent,
|
onLongPress: () =>
|
||||||
padding: EdgeInsets.all(24),
|
dashboardViewModel.balanceViewModel.isReversing =
|
||||||
child: Column(
|
!dashboardViewModel.balanceViewModel.isReversing,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
onLongPressUp: () =>
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
dashboardViewModel.balanceViewModel.isReversing =
|
||||||
children: <Widget>[
|
!dashboardViewModel.balanceViewModel.isReversing,
|
||||||
Observer(builder: (_) {
|
child: Container(
|
||||||
return Text(
|
color: Colors.transparent,
|
||||||
dashboardViewModel.balanceViewModel.currency.toString(),
|
padding: EdgeInsets.all(24),
|
||||||
style: TextStyle(
|
child: Column(
|
||||||
fontSize: 40,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
fontWeight: FontWeight.bold,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
color: Theme.of(context)
|
children: <Widget>[
|
||||||
.accentTextTheme
|
Observer(builder: (_) {
|
||||||
.display2
|
return Text(
|
||||||
.backgroundColor,
|
dashboardViewModel.balanceViewModel.currency.toString(),
|
||||||
height: 1),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
SizedBox(height: 10),
|
|
||||||
Observer(builder: (_) {
|
|
||||||
return Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Text(
|
|
||||||
'${dashboardViewModel.balanceViewModel.availableBalanceLabel} (${dashboardViewModel.balanceViewModel.availableFiatBalance.toString()})',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.accentTextTheme
|
|
||||||
.display2
|
|
||||||
.backgroundColor,
|
|
||||||
height: 1),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
SizedBox(height: 10),
|
|
||||||
Observer(builder: (_) {
|
|
||||||
return AutoSizeText(
|
|
||||||
dashboardViewModel.balanceViewModel.availableBalance,
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 54,
|
fontSize: 40,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.accentTextTheme
|
.accentTextTheme
|
||||||
.display3
|
.display2
|
||||||
.backgroundColor,
|
.backgroundColor,
|
||||||
height: 1),
|
height: 1),
|
||||||
maxLines: 1,
|
);
|
||||||
textAlign: TextAlign.center);
|
}),
|
||||||
}),
|
SizedBox(height: 10),
|
||||||
SizedBox(height: 10),
|
Observer(builder: (_) {
|
||||||
Observer(builder: (_) {
|
return Row(
|
||||||
return Row(
|
children: [
|
||||||
children: [
|
Expanded(
|
||||||
Expanded(
|
child: Text(
|
||||||
child: Text(
|
'${dashboardViewModel.balanceViewModel.availableBalanceLabel} (${dashboardViewModel.balanceViewModel.availableFiatBalance.toString()})',
|
||||||
'${dashboardViewModel.balanceViewModel.additionalBalanceLabel} (${dashboardViewModel.balanceViewModel.additionalFiatBalance.toString()})',
|
textAlign: TextAlign.center,
|
||||||
textAlign: TextAlign.center,
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 12,
|
||||||
fontSize: 12,
|
fontWeight: FontWeight.w600,
|
||||||
fontWeight: FontWeight.w600,
|
color: Theme.of(context)
|
||||||
color: Theme.of(context)
|
.accentTextTheme
|
||||||
.accentTextTheme
|
.display2
|
||||||
.display2
|
.backgroundColor,
|
||||||
.backgroundColor,
|
height: 1),
|
||||||
height: 1),
|
)
|
||||||
)
|
)
|
||||||
)
|
],
|
||||||
],
|
);
|
||||||
);
|
}),
|
||||||
}),
|
SizedBox(height: 10),
|
||||||
SizedBox(height: 10),
|
Observer(builder: (_) {
|
||||||
Observer(builder: (_) {
|
return AutoSizeText(
|
||||||
return AutoSizeText(
|
dashboardViewModel.balanceViewModel.availableBalance,
|
||||||
dashboardViewModel.balanceViewModel.additionalBalance
|
style: TextStyle(
|
||||||
.toString(),
|
fontSize: 54,
|
||||||
style: TextStyle(
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 18,
|
color: Theme.of(context)
|
||||||
fontWeight: FontWeight.bold,
|
.accentTextTheme
|
||||||
color: Theme.of(context)
|
.display3
|
||||||
.accentTextTheme
|
.backgroundColor,
|
||||||
.display3
|
height: 1),
|
||||||
.backgroundColor,
|
maxLines: 1,
|
||||||
height: 1),
|
textAlign: TextAlign.center);
|
||||||
maxLines: 1,
|
}),
|
||||||
textAlign: TextAlign.center);
|
SizedBox(height: 10),
|
||||||
}),
|
Observer(builder: (_) {
|
||||||
],
|
return Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
'${dashboardViewModel.balanceViewModel.additionalBalanceLabel} (${dashboardViewModel.balanceViewModel.additionalFiatBalance.toString()})',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.accentTextTheme
|
||||||
|
.display2
|
||||||
|
.backgroundColor,
|
||||||
|
height: 1),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
SizedBox(height: 10),
|
||||||
|
Observer(builder: (_) {
|
||||||
|
return AutoSizeText(
|
||||||
|
dashboardViewModel.balanceViewModel.additionalBalance
|
||||||
|
.toString(),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.accentTextTheme
|
||||||
|
.display3
|
||||||
|
.backgroundColor,
|
||||||
|
height: 1),
|
||||||
|
maxLines: 1,
|
||||||
|
textAlign: TextAlign.center);
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ class TransactionsPage extends StatelessWidget {
|
||||||
if (item is TradeListItem) {
|
if (item is TradeListItem) {
|
||||||
final trade = item.trade;
|
final trade = item.trade;
|
||||||
|
|
||||||
return TradeRow(
|
return Observer(builder: (_) => TradeRow(
|
||||||
onTap: () => Navigator.of(context).pushNamed(
|
onTap: () => Navigator.of(context).pushNamed(
|
||||||
Routes.tradeDetails,
|
Routes.tradeDetails,
|
||||||
arguments: trade),
|
arguments: trade),
|
||||||
|
@ -74,13 +74,13 @@ class TransactionsPage extends StatelessWidget {
|
||||||
createdAtFormattedDate:
|
createdAtFormattedDate:
|
||||||
DateFormat('HH:mm').format(trade.createdAt),
|
DateFormat('HH:mm').format(trade.createdAt),
|
||||||
formattedAmount: item.tradeFormattedAmount
|
formattedAmount: item.tradeFormattedAmount
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item is OrderListItem) {
|
if (item is OrderListItem) {
|
||||||
final order = item.order;
|
final order = item.order;
|
||||||
|
|
||||||
return OrderRow(
|
return Observer(builder: (_) => OrderRow(
|
||||||
onTap: () => Navigator.of(context).pushNamed(
|
onTap: () => Navigator.of(context).pushNamed(
|
||||||
Routes.orderDetails,
|
Routes.orderDetails,
|
||||||
arguments: order),
|
arguments: order),
|
||||||
|
@ -89,7 +89,7 @@ class TransactionsPage extends StatelessWidget {
|
||||||
createdAtFormattedDate:
|
createdAtFormattedDate:
|
||||||
DateFormat('HH:mm').format(order.createdAt),
|
DateFormat('HH:mm').format(order.createdAt),
|
||||||
formattedAmount: item.orderFormattedAmount,
|
formattedAmount: item.orderFormattedAmount,
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
|
|
|
@ -41,5 +41,5 @@ abstract class OrdersStoreBase with Store {
|
||||||
Future updateOrderList() async => orders =
|
Future updateOrderList() async => orders =
|
||||||
ordersSource.values.map((order) => OrderListItem(
|
ordersSource.values.map((order) => OrderListItem(
|
||||||
order: order,
|
order: order,
|
||||||
displayMode: settingsStore.balanceDisplayMode)).toList();
|
settingsStore: settingsStore)).toList();
|
||||||
}
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:cake_wallet/exchange/trade.dart';
|
import 'package:cake_wallet/exchange/trade.dart';
|
||||||
import 'package:cake_wallet/view_model/dashboard/trade_list_item.dart';
|
import 'package:cake_wallet/view_model/dashboard/trade_list_item.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:cake_wallet/store/settings_store.dart';
|
import 'package:cake_wallet/store/settings_store.dart';
|
||||||
|
@ -37,5 +36,5 @@ abstract class TradesStoreBase with Store {
|
||||||
Future updateTradeList() async => trades =
|
Future updateTradeList() async => trades =
|
||||||
tradesSource.values.map((trade) => TradeListItem(
|
tradesSource.values.map((trade) => TradeListItem(
|
||||||
trade: trade,
|
trade: trade,
|
||||||
displayMode: settingsStore.balanceDisplayMode)).toList();
|
settingsStore: settingsStore)).toList();
|
||||||
}
|
}
|
|
@ -69,9 +69,9 @@ abstract class BalanceViewModelBase with Store {
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
BalanceDisplayMode get displayMode => isReversing
|
BalanceDisplayMode get displayMode => isReversing
|
||||||
? (savedDisplayMode == BalanceDisplayMode.availableBalance
|
? savedDisplayMode == BalanceDisplayMode.hiddenBalance
|
||||||
? BalanceDisplayMode.fullBalance
|
? BalanceDisplayMode.displayableBalance
|
||||||
: BalanceDisplayMode.availableBalance)
|
: savedDisplayMode
|
||||||
: savedDisplayMode;
|
: savedDisplayMode;
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
|
@ -96,7 +96,7 @@ abstract class BalanceViewModelBase with Store {
|
||||||
String get availableBalance {
|
String get availableBalance {
|
||||||
final walletBalance = _walletBalance;
|
final walletBalance = _walletBalance;
|
||||||
|
|
||||||
if (settingsStore.balanceDisplayMode == BalanceDisplayMode.hiddenBalance) {
|
if (displayMode == BalanceDisplayMode.hiddenBalance) {
|
||||||
return '---';
|
return '---';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ abstract class BalanceViewModelBase with Store {
|
||||||
String get additionalBalance {
|
String get additionalBalance {
|
||||||
final walletBalance = _walletBalance;
|
final walletBalance = _walletBalance;
|
||||||
|
|
||||||
if (settingsStore.balanceDisplayMode == BalanceDisplayMode.hiddenBalance) {
|
if (displayMode == BalanceDisplayMode.hiddenBalance) {
|
||||||
return '---';
|
return '---';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ abstract class BalanceViewModelBase with Store {
|
||||||
final walletBalance = _walletBalance;
|
final walletBalance = _walletBalance;
|
||||||
final fiatCurrency = settingsStore.fiatCurrency;
|
final fiatCurrency = settingsStore.fiatCurrency;
|
||||||
|
|
||||||
if (settingsStore.balanceDisplayMode == BalanceDisplayMode.hiddenBalance) {
|
if (displayMode == BalanceDisplayMode.hiddenBalance) {
|
||||||
return '---';
|
return '---';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ abstract class BalanceViewModelBase with Store {
|
||||||
final walletBalance = _walletBalance;
|
final walletBalance = _walletBalance;
|
||||||
final fiatCurrency = settingsStore.fiatCurrency;
|
final fiatCurrency = settingsStore.fiatCurrency;
|
||||||
|
|
||||||
if (settingsStore.balanceDisplayMode == BalanceDisplayMode.hiddenBalance) {
|
if (displayMode == BalanceDisplayMode.hiddenBalance) {
|
||||||
return '---';
|
return '---';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,21 @@
|
||||||
import 'package:cake_wallet/entities/order.dart';
|
import 'package:cake_wallet/entities/order.dart';
|
||||||
|
import 'package:cake_wallet/store/settings_store.dart';
|
||||||
import 'package:cake_wallet/view_model/dashboard/action_list_item.dart';
|
import 'package:cake_wallet/view_model/dashboard/action_list_item.dart';
|
||||||
import 'package:cake_wallet/entities/balance_display_mode.dart';
|
import 'package:cake_wallet/entities/balance_display_mode.dart';
|
||||||
|
|
||||||
class OrderListItem extends ActionListItem {
|
class OrderListItem extends ActionListItem {
|
||||||
OrderListItem({this.order, this.displayMode});
|
OrderListItem({this.order, this.settingsStore});
|
||||||
|
|
||||||
final Order order;
|
final Order order;
|
||||||
final BalanceDisplayMode displayMode;
|
final SettingsStore settingsStore;
|
||||||
|
|
||||||
|
BalanceDisplayMode get displayMode => settingsStore.balanceDisplayMode;
|
||||||
|
|
||||||
String get orderFormattedAmount {
|
String get orderFormattedAmount {
|
||||||
return order.amount != null
|
return order.amount != null
|
||||||
? displayMode == BalanceDisplayMode.hiddenBalance
|
? displayMode == BalanceDisplayMode.hiddenBalance
|
||||||
? '---'
|
? '---'
|
||||||
: order.amountFormatted()
|
: order.amountFormatted()
|
||||||
: order.amount;
|
: order.amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
import 'package:cake_wallet/exchange/trade.dart';
|
import 'package:cake_wallet/exchange/trade.dart';
|
||||||
|
import 'package:cake_wallet/store/settings_store.dart';
|
||||||
import 'package:cake_wallet/view_model/dashboard/action_list_item.dart';
|
import 'package:cake_wallet/view_model/dashboard/action_list_item.dart';
|
||||||
import 'package:cake_wallet/entities/balance_display_mode.dart';
|
import 'package:cake_wallet/entities/balance_display_mode.dart';
|
||||||
|
|
||||||
class TradeListItem extends ActionListItem {
|
class TradeListItem extends ActionListItem {
|
||||||
TradeListItem({this.trade, this.displayMode});
|
TradeListItem({this.trade, this.settingsStore});
|
||||||
|
|
||||||
final Trade trade;
|
final Trade trade;
|
||||||
final BalanceDisplayMode displayMode;
|
final SettingsStore settingsStore;
|
||||||
|
|
||||||
|
BalanceDisplayMode get displayMode => settingsStore.balanceDisplayMode;
|
||||||
|
|
||||||
String get tradeFormattedAmount {
|
String get tradeFormattedAmount {
|
||||||
return trade.amount != null
|
return trade.amount != null
|
||||||
|
|
Loading…
Reference in a new issue