2020-07-23 12:20:52 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
|
|
|
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
|
|
|
import 'package:cake_wallet/src/domain/exchange/exchange_provider_description.dart';
|
|
|
|
import 'package:date_range_picker/date_range_picker.dart' as date_rage_picker;
|
|
|
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
|
|
|
|
|
|
|
class HeaderRow extends StatelessWidget {
|
|
|
|
HeaderRow({this.dashboardViewModel});
|
|
|
|
|
|
|
|
final DashboardViewModel dashboardViewModel;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2020-08-19 17:57:06 +00:00
|
|
|
final filterIcon = Image.asset('assets/images/filter_icon.png',
|
|
|
|
color: Theme.of(context).textTheme.caption.decorationColor);
|
|
|
|
|
2020-07-23 12:20:52 +00:00
|
|
|
return Container(
|
|
|
|
height: 52,
|
|
|
|
color: Colors.transparent,
|
|
|
|
padding: EdgeInsets.only(left: 24, right: 24),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: <Widget>[
|
|
|
|
Text(
|
|
|
|
S.of(context).transactions,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 20,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
color: Colors.white
|
|
|
|
),
|
|
|
|
),
|
|
|
|
PopupMenuButton<int>(
|
|
|
|
itemBuilder: (context) => [
|
|
|
|
PopupMenuItem(
|
|
|
|
enabled: false,
|
|
|
|
value: -1,
|
|
|
|
child: Text(S.of(context).transactions,
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
2020-08-19 17:57:06 +00:00
|
|
|
color: Theme.of(context).primaryTextTheme.title.color))),
|
2020-07-23 12:20:52 +00:00
|
|
|
PopupMenuItem(
|
|
|
|
value: 0,
|
|
|
|
child: Observer(
|
|
|
|
builder: (_) => Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment
|
|
|
|
.spaceBetween,
|
|
|
|
children: [
|
2020-08-19 17:57:06 +00:00
|
|
|
Text(S.of(context).incoming,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).primaryTextTheme.title.color
|
|
|
|
),
|
|
|
|
),
|
2020-07-23 12:20:52 +00:00
|
|
|
Checkbox(
|
|
|
|
value: dashboardViewModel
|
|
|
|
.transactionFilterStore
|
|
|
|
.displayIncoming,
|
|
|
|
onChanged: (value) => dashboardViewModel
|
|
|
|
.transactionFilterStore
|
|
|
|
.toggleIncoming()
|
|
|
|
)
|
|
|
|
]))),
|
|
|
|
PopupMenuItem(
|
|
|
|
value: 1,
|
|
|
|
child: Observer(
|
|
|
|
builder: (_) => Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment
|
|
|
|
.spaceBetween,
|
|
|
|
children: [
|
2020-08-19 17:57:06 +00:00
|
|
|
Text(S.of(context).outgoing,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).primaryTextTheme.title.color
|
|
|
|
)
|
|
|
|
),
|
2020-07-23 12:20:52 +00:00
|
|
|
Checkbox(
|
|
|
|
value: dashboardViewModel
|
|
|
|
.transactionFilterStore
|
|
|
|
.displayOutgoing,
|
|
|
|
onChanged: (value) => dashboardViewModel
|
|
|
|
.transactionFilterStore
|
|
|
|
.toggleOutgoing(),
|
|
|
|
)
|
|
|
|
]))),
|
|
|
|
PopupMenuItem(
|
|
|
|
value: 2,
|
|
|
|
child:
|
2020-08-19 17:57:06 +00:00
|
|
|
Text(S.of(context).transactions_by_date,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).primaryTextTheme.title.color
|
|
|
|
)
|
|
|
|
)),
|
2020-07-23 12:20:52 +00:00
|
|
|
PopupMenuDivider(),
|
|
|
|
PopupMenuItem(
|
|
|
|
enabled: false,
|
|
|
|
value: -1,
|
|
|
|
child: Text(S.of(context).trades,
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
2020-08-19 17:57:06 +00:00
|
|
|
color: Theme.of(context).primaryTextTheme.title.color))),
|
2020-07-23 12:20:52 +00:00
|
|
|
PopupMenuItem(
|
|
|
|
value: 3,
|
|
|
|
child: Observer(
|
|
|
|
builder: (_) => Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment
|
|
|
|
.spaceBetween,
|
|
|
|
children: [
|
2020-08-19 17:57:06 +00:00
|
|
|
Text('XMR.TO',
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).primaryTextTheme.title.color
|
|
|
|
)
|
|
|
|
),
|
2020-07-23 12:20:52 +00:00
|
|
|
Checkbox(
|
|
|
|
value: dashboardViewModel
|
|
|
|
.tradeFilterStore
|
|
|
|
.displayXMRTO,
|
|
|
|
onChanged: (value) => dashboardViewModel
|
|
|
|
.tradeFilterStore
|
|
|
|
.toggleDisplayExchange(
|
|
|
|
ExchangeProviderDescription
|
|
|
|
.xmrto),
|
|
|
|
)
|
|
|
|
]))),
|
|
|
|
PopupMenuItem(
|
|
|
|
value: 4,
|
|
|
|
child: Observer(
|
|
|
|
builder: (_) => Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment
|
|
|
|
.spaceBetween,
|
|
|
|
children: [
|
2020-08-19 17:57:06 +00:00
|
|
|
Text('Change.NOW',
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).primaryTextTheme.title.color
|
|
|
|
)
|
|
|
|
),
|
2020-07-23 12:20:52 +00:00
|
|
|
Checkbox(
|
|
|
|
value: dashboardViewModel
|
|
|
|
.tradeFilterStore
|
|
|
|
.displayChangeNow,
|
|
|
|
onChanged: (value) => dashboardViewModel
|
|
|
|
.tradeFilterStore
|
|
|
|
.toggleDisplayExchange(
|
|
|
|
ExchangeProviderDescription
|
|
|
|
.changeNow),
|
|
|
|
)
|
|
|
|
]))),
|
|
|
|
PopupMenuItem(
|
|
|
|
value: 5,
|
|
|
|
child: Observer(
|
|
|
|
builder: (_) => Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment
|
|
|
|
.spaceBetween,
|
|
|
|
children: [
|
2020-08-19 17:57:06 +00:00
|
|
|
Text('MorphToken',
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context).primaryTextTheme.title.color
|
|
|
|
)
|
|
|
|
),
|
2020-07-23 12:20:52 +00:00
|
|
|
Checkbox(
|
|
|
|
value: dashboardViewModel
|
|
|
|
.tradeFilterStore
|
|
|
|
.displayMorphToken,
|
|
|
|
onChanged: (value) => dashboardViewModel
|
|
|
|
.tradeFilterStore
|
|
|
|
.toggleDisplayExchange(
|
|
|
|
ExchangeProviderDescription
|
|
|
|
.morphToken),
|
|
|
|
)
|
|
|
|
])))
|
|
|
|
],
|
|
|
|
child: Container(
|
|
|
|
height: 36,
|
|
|
|
width: 36,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
2020-08-19 17:57:06 +00:00
|
|
|
color: Theme.of(context).textTheme.overline.color
|
2020-07-23 12:20:52 +00:00
|
|
|
),
|
|
|
|
child: filterIcon,
|
|
|
|
),
|
|
|
|
onSelected: (item) async {
|
|
|
|
if (item == 2) {
|
|
|
|
final picked =
|
|
|
|
await date_rage_picker.showDatePicker(
|
|
|
|
context: context,
|
|
|
|
initialFirstDate: DateTime.now()
|
|
|
|
.subtract(Duration(days: 1)),
|
|
|
|
initialLastDate: (DateTime.now()),
|
|
|
|
firstDate: DateTime(2015),
|
|
|
|
lastDate: DateTime.now()
|
|
|
|
.add(Duration(days: 1)));
|
|
|
|
|
|
|
|
if (picked != null && picked.length == 2) {
|
|
|
|
dashboardViewModel.transactionFilterStore
|
|
|
|
.changeStartDate(picked.first);
|
|
|
|
dashboardViewModel.transactionFilterStore
|
|
|
|
.changeEndDate(picked.last);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|