2022-03-18 10:47:57 +00:00
|
|
|
import 'package:cake_wallet/di.dart';
|
|
|
|
import 'package:cake_wallet/store/settings_store.dart';
|
|
|
|
import 'package:cake_wallet/themes/theme_base.dart';
|
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';
|
2021-06-04 15:25:17 +00:00
|
|
|
import 'package:flutter/scheduler.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
|
|
|
|
2022-03-18 10:47:57 +00:00
|
|
|
class BalancePage extends StatelessWidget{
|
|
|
|
BalancePage({@required this.dashboardViewModel, @required this.settingsStore});
|
2020-07-21 17:22:41 +00:00
|
|
|
|
|
|
|
final DashboardViewModel dashboardViewModel;
|
2022-03-18 10:47:57 +00:00
|
|
|
final SettingsStore settingsStore;
|
|
|
|
|
|
|
|
Color get backgroundLightColor =>
|
|
|
|
settingsStore.currentTheme.type == ThemeType.bright ? Colors.transparent : Colors.white;
|
2020-07-21 17:22:41 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2021-03-31 17:22:41 +00:00
|
|
|
return GestureDetector(
|
|
|
|
onLongPress: () =>
|
|
|
|
dashboardViewModel.balanceViewModel.isReversing =
|
|
|
|
!dashboardViewModel.balanceViewModel.isReversing,
|
|
|
|
onLongPressUp: () =>
|
|
|
|
dashboardViewModel.balanceViewModel.isReversing =
|
|
|
|
!dashboardViewModel.balanceViewModel.isReversing,
|
2022-03-18 10:47:57 +00:00
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
SizedBox(height: 56),
|
|
|
|
Container(
|
|
|
|
alignment: Alignment.topLeft,
|
|
|
|
margin: const EdgeInsets.only(left: 24, bottom: 16),
|
|
|
|
child: Observer(builder: (_) {
|
|
|
|
return AutoSizeText(
|
|
|
|
dashboardViewModel.balanceViewModel.asset,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 24,
|
|
|
|
fontFamily: 'Lato',
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.accentTextTheme
|
|
|
|
.display3
|
|
|
|
.backgroundColor,
|
|
|
|
height: 1),
|
|
|
|
maxLines: 1,
|
|
|
|
textAlign: TextAlign.center);
|
|
|
|
})),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
margin: const EdgeInsets.only(left: 16, right: 16),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(30.0),
|
|
|
|
border: Border.all(color: settingsStore.currentTheme.type == ThemeType.bright ? Color.fromRGBO(255, 255, 255, 0.2): Colors.transparent, width: 1, ),
|
|
|
|
color:Theme.of(context).textTheme.title.backgroundColor
|
|
|
|
),
|
|
|
|
child: Container(
|
|
|
|
margin: const EdgeInsets.only(top: 24, left: 24, right: 24, bottom: 24),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
SizedBox(height: 8,),
|
|
|
|
Observer(builder: (_) {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'${dashboardViewModel.balanceViewModel.availableBalanceLabel}',
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12,
|
|
|
|
fontFamily: 'Lato',
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.accentTextTheme
|
|
|
|
.display2
|
|
|
|
.backgroundColor,
|
|
|
|
height: 1),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
SizedBox(height: 8,),
|
|
|
|
Observer(builder: (_) {
|
|
|
|
return AutoSizeText(
|
|
|
|
dashboardViewModel.balanceViewModel.availableBalance,
|
2021-03-31 16:18:33 +00:00
|
|
|
style: TextStyle(
|
2022-03-18 10:47:57 +00:00
|
|
|
fontSize: 24,
|
|
|
|
fontFamily: 'Lato',
|
|
|
|
|
|
|
|
fontWeight: FontWeight.w900,
|
2021-03-31 16:18:33 +00:00
|
|
|
color: Theme.of(context)
|
|
|
|
.accentTextTheme
|
2022-03-18 10:47:57 +00:00
|
|
|
.display3
|
2021-03-31 16:18:33 +00:00
|
|
|
.backgroundColor,
|
|
|
|
height: 1),
|
2022-03-18 10:47:57 +00:00
|
|
|
maxLines: 1,
|
|
|
|
textAlign: TextAlign.center);
|
|
|
|
}),
|
|
|
|
SizedBox(height: 4,),
|
|
|
|
Observer(builder: (_) {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'${dashboardViewModel.balanceViewModel.availableFiatBalance.toString()}',
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontFamily: 'Lato',
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.accentTextTheme
|
|
|
|
.display3
|
|
|
|
.backgroundColor,
|
|
|
|
height: 1),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
SizedBox(height: 26),
|
|
|
|
Observer(builder: (_) {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'${dashboardViewModel.balanceViewModel.additionalBalanceLabel}',
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12,
|
|
|
|
fontFamily: 'Lato',
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.accentTextTheme
|
|
|
|
.display2
|
|
|
|
.backgroundColor,
|
|
|
|
height: 1),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
SizedBox(height: 8),
|
|
|
|
Observer(builder: (_) {
|
|
|
|
return AutoSizeText(
|
|
|
|
dashboardViewModel.balanceViewModel.additionalBalance
|
|
|
|
.toString(),
|
2021-03-31 16:18:33 +00:00
|
|
|
style: TextStyle(
|
2022-03-18 10:47:57 +00:00
|
|
|
fontSize: 24,
|
|
|
|
fontFamily: 'Lato',
|
|
|
|
fontWeight: FontWeight.w900,
|
2021-03-31 16:18:33 +00:00
|
|
|
color: Theme.of(context)
|
|
|
|
.accentTextTheme
|
2022-03-18 10:47:57 +00:00
|
|
|
.display3
|
2021-03-31 16:18:33 +00:00
|
|
|
.backgroundColor,
|
|
|
|
height: 1),
|
2022-03-18 10:47:57 +00:00
|
|
|
maxLines: 1,
|
|
|
|
textAlign: TextAlign.center);
|
|
|
|
}),
|
|
|
|
SizedBox(height: 4,),
|
|
|
|
Observer(builder: (_) {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'${dashboardViewModel.balanceViewModel.additionalFiatBalance.toString()}',
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontFamily: 'Lato',
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.accentTextTheme
|
|
|
|
.display3
|
|
|
|
.backgroundColor,
|
|
|
|
height: 1),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Observer(builder: (_) {
|
|
|
|
return Text(
|
|
|
|
dashboardViewModel.balanceViewModel.currency.toString(),
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 28,
|
|
|
|
fontFamily: 'Lato',
|
|
|
|
fontWeight: FontWeight.w800,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.accentTextTheme
|
|
|
|
.display3
|
|
|
|
.backgroundColor,
|
|
|
|
height: 1),
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
2021-01-11 17:15:27 +00:00
|
|
|
),
|
2022-03-18 10:47:57 +00:00
|
|
|
|
2021-01-11 17:15:27 +00:00
|
|
|
);
|
2020-07-21 17:22:41 +00:00
|
|
|
}
|
|
|
|
}
|