2020-07-21 17:22:41 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2020-07-23 12:20:52 +00:00
|
|
|
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
2020-07-21 17:22:41 +00:00
|
|
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
2020-09-29 08:45:35 +00:00
|
|
|
import 'package:auto_size_text/auto_size_text.dart';
|
2020-07-21 17:22:41 +00:00
|
|
|
|
|
|
|
class BalancePage extends StatelessWidget {
|
|
|
|
BalancePage({@required this.dashboardViewModel});
|
|
|
|
|
|
|
|
final DashboardViewModel dashboardViewModel;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2020-12-18 15:49:10 +00:00
|
|
|
return GestureDetector(
|
|
|
|
onTapUp: (_) {
|
|
|
|
if (dashboardViewModel.balanceViewModel.canReverse) {
|
|
|
|
dashboardViewModel.balanceViewModel.isReversing = false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onTapDown: (_) {
|
|
|
|
if (dashboardViewModel.balanceViewModel.canReverse) {
|
|
|
|
dashboardViewModel.balanceViewModel.isReversing = true;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
color: Colors.transparent,
|
|
|
|
padding: EdgeInsets.all(24),
|
2020-12-15 16:29:10 +00:00
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: <Widget>[
|
|
|
|
Observer(builder: (_) {
|
|
|
|
return Text(
|
|
|
|
dashboardViewModel.balanceViewModel.currency.toString(),
|
2020-09-29 08:45:35 +00:00
|
|
|
style: TextStyle(
|
2020-12-15 16:29:10 +00:00
|
|
|
fontSize: 40,
|
2020-09-29 08:45:35 +00:00
|
|
|
fontWeight: FontWeight.bold,
|
2020-12-18 18:42:28 +00:00
|
|
|
color: Theme.of(context)
|
|
|
|
.accentTextTheme
|
|
|
|
.display2
|
2020-12-11 18:46:20 +00:00
|
|
|
.backgroundColor,
|
2020-09-29 08:45:35 +00:00
|
|
|
height: 1),
|
2020-12-15 16:29:10 +00:00
|
|
|
);
|
|
|
|
}),
|
|
|
|
Observer(builder: (_) {
|
|
|
|
return Text(
|
|
|
|
dashboardViewModel.balanceViewModel.displayMode.toString(),
|
2020-09-29 08:45:35 +00:00
|
|
|
style: TextStyle(
|
2020-12-15 16:29:10 +00:00
|
|
|
fontSize: 12,
|
|
|
|
fontWeight: FontWeight.w600,
|
2020-12-18 18:42:28 +00:00
|
|
|
color: Theme.of(context)
|
|
|
|
.accentTextTheme
|
|
|
|
.display2
|
2020-12-11 18:46:20 +00:00
|
|
|
.backgroundColor,
|
2020-09-29 08:45:35 +00:00
|
|
|
height: 1),
|
2020-12-15 16:29:10 +00:00
|
|
|
);
|
|
|
|
}),
|
|
|
|
SizedBox(height: 10),
|
|
|
|
Observer(builder: (_) {
|
|
|
|
return AutoSizeText(
|
2020-12-18 18:42:28 +00:00
|
|
|
dashboardViewModel.balanceViewModel.cryptoBalance,
|
|
|
|
style: TextStyle(
|
2020-12-21 20:20:46 +00:00
|
|
|
fontSize: 54,
|
2020-12-18 18:42:28 +00:00
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.accentTextTheme
|
|
|
|
.display3
|
|
|
|
.backgroundColor,
|
|
|
|
height: 1),
|
2020-12-21 20:20:46 +00:00
|
|
|
maxLines: 1,
|
|
|
|
textAlign: TextAlign.center);
|
2020-12-15 16:29:10 +00:00
|
|
|
}),
|
|
|
|
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);
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
));
|
2020-07-21 17:22:41 +00:00
|
|
|
}
|
|
|
|
}
|