2020-01-04 19:31:52 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
2020-06-20 07:10:00 +00:00
|
|
|
import 'package:cake_wallet/view_model/dashboard_view_model.dart';
|
2020-04-14 18:15:47 +00:00
|
|
|
import 'package:cake_wallet/src/screens/dashboard/widgets/wallet_card.dart';
|
2020-04-16 18:41:04 +00:00
|
|
|
import 'package:cake_wallet/src/screens/dashboard/widgets/trade_history_panel.dart';
|
2020-05-29 15:10:11 +00:00
|
|
|
import 'package:cake_wallet/src/screens/dashboard/widgets/menu_widget.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
|
2020-05-29 15:10:11 +00:00
|
|
|
class DashboardPage extends StatelessWidget {
|
2020-06-20 07:10:00 +00:00
|
|
|
DashboardPage({@required this.walletViewModel});
|
|
|
|
|
|
|
|
final DashboardViewModel walletViewModel;
|
2020-01-04 19:31:52 +00:00
|
|
|
final _bodyKey = GlobalKey();
|
|
|
|
|
2020-04-14 18:15:47 +00:00
|
|
|
@override
|
2020-06-20 07:10:00 +00:00
|
|
|
Widget build(BuildContext context) =>
|
|
|
|
DashboardPageBody(key: _bodyKey, walletViewModel: walletViewModel);
|
2020-01-04 19:31:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class DashboardPageBody extends StatefulWidget {
|
2020-06-20 07:10:00 +00:00
|
|
|
DashboardPageBody({Key key, @required this.walletViewModel})
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
final DashboardViewModel walletViewModel;
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
DashboardPageBodyState createState() => DashboardPageBodyState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class DashboardPageBodyState extends State<DashboardPageBody> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2020-06-20 07:10:00 +00:00
|
|
|
final menuButton = Image.asset(
|
|
|
|
'assets/images/header.png',
|
2020-05-29 15:10:11 +00:00
|
|
|
color: Theme.of(context).primaryTextTheme.title.color,
|
|
|
|
);
|
2020-04-14 18:15:47 +00:00
|
|
|
|
|
|
|
return SafeArea(
|
2020-05-29 15:10:11 +00:00
|
|
|
child: Scaffold(
|
|
|
|
body: Container(
|
|
|
|
decoration: BoxDecoration(
|
2020-06-20 07:10:00 +00:00
|
|
|
gradient: LinearGradient(colors: [
|
|
|
|
Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
Theme.of(context).primaryColor
|
|
|
|
], begin: Alignment.centerLeft, end: Alignment.centerRight)),
|
2020-05-29 15:10:11 +00:00
|
|
|
child: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.only(top: 10, right: 10),
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
child: SizedBox(
|
|
|
|
height: 44,
|
|
|
|
width: 44,
|
|
|
|
child: ButtonTheme(
|
|
|
|
minWidth: double.minPositive,
|
|
|
|
child: FlatButton(
|
|
|
|
highlightColor: Colors.transparent,
|
|
|
|
splashColor: Colors.transparent,
|
|
|
|
padding: EdgeInsets.all(0),
|
|
|
|
onPressed: () async {
|
|
|
|
await showDialog<void>(
|
2020-06-20 07:10:00 +00:00
|
|
|
builder: (_) => MenuWidget(), context: context);
|
2020-05-29 15:10:11 +00:00
|
|
|
},
|
|
|
|
child: menuButton),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
2020-06-20 07:10:00 +00:00
|
|
|
padding: EdgeInsets.only(left: 20, top: 20),
|
|
|
|
child: WalletCard(walletVM: widget.walletViewModel)),
|
|
|
|
SizedBox(height: 28),
|
|
|
|
Expanded(child: TradeHistoryPanel(dashboardViewModel: widget.walletViewModel))
|
2020-05-29 15:10:11 +00:00
|
|
|
],
|
|
|
|
),
|
2020-04-14 18:15:47 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
2020-01-04 19:31:52 +00:00
|
|
|
}
|
|
|
|
}
|