Merge pull request #625 from cake-tech/CW-122-Rework-filter-on-the-transactions-list-screen

[CW-122] rework filter on the transactions list screen
This commit is contained in:
Omar Hatem 2022-12-28 20:50:17 +02:00 committed by GitHub
commit 9bd0de6d08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 314 additions and 284 deletions

View file

@ -24,6 +24,9 @@ class ExchangeProviderDescription extends EnumerableItem<int>
static const simpleSwap =
ExchangeProviderDescription(title: 'SimpleSwap', raw: 4, image: 'assets/images/simpleSwap.png');
static const all =
ExchangeProviderDescription(title: 'All trades', raw: 5, image:'');
static ExchangeProviderDescription deserialize({required int raw}) {
switch (raw) {
case 0:
@ -36,6 +39,8 @@ class ExchangeProviderDescription extends EnumerableItem<int>
return sideShift;
case 4:
return simpleSwap;
case 5:
return all;
default:
throw Exception('Unexpected token: $raw for ExchangeProviderDescription deserialize');
}

View file

@ -9,12 +9,7 @@ class FilterTile extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
width: double.infinity,
padding: EdgeInsets.only(
top: 18,
bottom: 18,
left: 24,
right: 24
),
padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 24.0),
child: child,
);
}

View file

@ -1,25 +1,26 @@
import 'dart:ui';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/filter_tile.dart';
import 'package:cake_wallet/src/widgets/section_divider.dart';
import 'package:cake_wallet/src/widgets/standard_checkbox.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/src/widgets/alert_background.dart';
import 'package:cake_wallet/src/widgets/alert_close_button.dart';
import 'package:cake_wallet/src/widgets/checkbox_widget.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
//import 'package:date_range_picker/date_range_picker.dart' as date_rage_picker;
class FilterWidget extends StatelessWidget {
FilterWidget({required this.dashboardViewModel});
final DashboardViewModel dashboardViewModel;
final backVector = Image.asset('assets/images/back_vector.png',
color: Palette.darkBlueCraiola
);
final closeIcon = Image.asset('assets/images/close.png', color: Palette.darkBlueCraiola);
@override
Widget build(BuildContext context) {
const sectionDivider = const SectionDivider();
return AlertBackground(
child: Stack(
alignment: Alignment.center,
@ -27,129 +28,82 @@ class FilterWidget extends StatelessWidget {
Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
S.of(context).filters,
style: TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.bold,
fontFamily: 'Lato',
decoration: TextDecoration.none,
),
),
Padding(
padding: EdgeInsets.only(
left: 24,
right: 24,
top: 24
),
padding: EdgeInsets.only(left: 24, right: 24, top: 24),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(14)),
borderRadius: BorderRadius.all(Radius.circular(24)),
child: Container(
color: Theme.of(context).textTheme!.bodyText1!.decorationColor!,
child: ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: dashboardViewModel.filterItems.length,
separatorBuilder: (context, _) => Container(
height: 1,
color: Theme.of(context).accentTextTheme!.subtitle1!.backgroundColor!,
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Padding(
padding: EdgeInsets.all(24.0),
child: Text(
S.of(context).filter_by,
style: TextStyle(
color: Theme.of(context).primaryTextTheme.overline!.color!,
fontSize: 16,
fontFamily: 'Lato',
decoration: TextDecoration.none,
),
),
),
itemBuilder: (_, index1) {
final title = dashboardViewModel.filterItems.keys.elementAt(index1);
final section = dashboardViewModel.filterItems.values.elementAt(index1);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(
top: 20,
left: 24,
right: 24
),
child: Text(
title,
style: TextStyle(
color: Theme.of(context).accentTextTheme!.subtitle1!.color!,
fontSize: 16,
fontWeight: FontWeight.w500,
fontFamily: 'Lato',
decoration: TextDecoration.none
sectionDivider,
ListView.separated(
padding: EdgeInsets.zero,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: dashboardViewModel.filterItems.length,
separatorBuilder: (context, _) => sectionDivider,
itemBuilder: (_, index1) {
final title = dashboardViewModel.filterItems.keys.elementAt(index1);
final section = dashboardViewModel.filterItems.values.elementAt(index1);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 20, left: 24, right: 24),
child: Text(
title,
style: TextStyle(
color: Theme.of(context).primaryTextTheme!.headline6!.color!,
fontSize: 16,
fontFamily: 'Lato',
fontWeight: FontWeight.bold,
decoration: TextDecoration.none),
),
),
),
ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: section.length,
separatorBuilder: (context, _) => Container(
height: 1,
padding: EdgeInsets.only(left: 24),
color: Theme.of(context).textTheme!.bodyText1!.decorationColor!,
child: Container(
height: 1,
color: Theme.of(context).accentTextTheme!.subtitle1!.backgroundColor!,
),
),
itemBuilder: (_, index2) {
final item = section[index2];
final content = item.onChanged != null
? CheckboxWidget(
value: item.value(),
caption: item.caption,
onChanged: item.onChanged
)
: GestureDetector(
onTap: () async {
//final List<DateTime> 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);
//}
},
child: Padding(
padding: EdgeInsets.only(left: 32),
child: Text(
item.caption,
style: TextStyle(
color: Theme.of(context).primaryTextTheme!.headline6!.color!,
fontSize: 18,
fontFamily: 'Lato',
fontWeight: FontWeight.w500,
decoration: TextDecoration.none
),
),
),
);
return FilterTile(child: content);
},
)
],
);
},
),
ListView.builder(
padding: EdgeInsets.symmetric(vertical: 8.0),
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: section.length,
itemBuilder: (_, index2) {
final item = section[index2];
final content = Observer(
builder: (_) => StandardCheckbox(
value: item.value(),
caption: item.caption,
gradientBackground: true,
borderColor: Theme.of(context).dividerColor,
iconColor: Colors.white,
onChanged: (value) => item.onChanged(),
));
return FilterTile(child: content);
},
)
],
);
},
),
]),
),
),
),
],
),
AlertCloseButton(image: backVector)
AlertCloseButton(image: closeIcon)
],
),
);
}
}
}

View file

@ -40,7 +40,6 @@ class ExchangePage extends BasePage {
final ExchangeViewModel exchangeViewModel;
final depositKey = GlobalKey<ExchangeCardState>();
final receiveKey = GlobalKey<ExchangeCardState>();
final checkBoxKey = GlobalKey<StandardCheckboxState>();
final _formKey = GlobalKey<FormState>();
final _depositAmountFocus = FocusNode();
final _depositAddressFocus = FocusNode();
@ -339,7 +338,6 @@ class ExchangePage extends BasePage {
mainAxisAlignment: MainAxisAlignment.start,
children: [
StandardCheckbox(
key: checkBoxKey,
value: exchangeViewModel.isFixedRateMode,
caption: S.of(context).fixed_rate,
onChanged: (value) =>
@ -682,12 +680,6 @@ class ExchangePage extends BasePage {
}
});
reaction((_) => exchangeViewModel.isFixedRateMode, (bool value) {
if (checkBoxKey.currentState!.value != exchangeViewModel.isFixedRateMode) {
checkBoxKey.currentState!.value = exchangeViewModel.isFixedRateMode;
}
});
depositAddressController.addListener(
() => exchangeViewModel.depositAddress = depositAddressController.text);

View file

@ -8,7 +8,7 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/core/execution_state.dart';
import 'package:cake_wallet/src/screens/exchange_trade/information_page.dart';
import 'package:cake_wallet/src/screens/send/widgets/confirm_sending_alert.dart';
import 'package:cake_wallet/src/widgets/standart_list_row.dart';
import 'package:cake_wallet/src/widgets/list_row.dart';
import 'package:cake_wallet/utils/show_bar.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/exchange/exchange_trade_view_model.dart';
@ -194,7 +194,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
final item = widget.exchangeTradeViewModel.items[index];
final value = item.data ?? fetchingLabel;
final content = StandartListRow(
final content = ListRow(
title: item.title,
value: value,
valueFontSize: 14,

View file

@ -1,4 +1,5 @@
import 'dart:ui';
import 'package:cake_wallet/src/widgets/section_divider.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
@ -84,10 +85,7 @@ class MoneroAccountListPage extends StatelessWidget {
padding: EdgeInsets.zero,
controller: controller,
separatorBuilder: (context, index) =>
Container(
height: 1,
color: Theme.of(context).dividerColor,
),
const SectionDivider(),
itemCount: accounts.length ?? 0,
itemBuilder: (context, index) {
final account = accounts[index];

View file

@ -7,7 +7,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/standart_list_row.dart';
import 'package:cake_wallet/src/widgets/list_row.dart';
import 'package:cake_wallet/src/screens/trade_details/track_trade_list_item.dart';
class OrderDetailsPage extends BasePage {
@ -57,7 +57,7 @@ class OrderDetailsPageBodyState extends State<OrderDetailsPageBody> {
if (item is TrackTradeListItem) {
return GestureDetector(
onTap: item.onTap,
child: StandartListRow(
child: ListRow(
title: '${item.title}', value: '${item.value}'));
} else {
return GestureDetector(
@ -65,7 +65,7 @@ class OrderDetailsPageBodyState extends State<OrderDetailsPageBody> {
Clipboard.setData(ClipboardData(text: '${item.value}'));
showBar<void>(context, S.of(context).copied_to_clipboard);
},
child: StandartListRow(
child: ListRow(
title: '${item.title}', value: '${item.value}'));
}
});

View file

@ -1,4 +1,5 @@
import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
import 'package:cake_wallet/src/widgets/section_divider.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
@ -135,8 +136,7 @@ class ReceivePage extends BasePage {
Observer(
builder: (_) => ListView.separated(
padding: EdgeInsets.all(0),
separatorBuilder: (context, _) => Container(
height: 1, color: Theme.of(context).dividerColor),
separatorBuilder: (context, _) => const SectionDivider(),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: addressListViewModel.items.length,

View file

@ -1,4 +1,5 @@
import 'package:cake_wallet/src/widgets/cake_scrollbar.dart';
import 'package:cake_wallet/src/widgets/section_divider.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/src/widgets/base_alert_dialog.dart';
@ -70,10 +71,7 @@ class ChooseYatAddressButtonsState extends State<ChooseYatAddressButtons> {
controller: controller,
padding: EdgeInsets.all(0),
itemCount: itemCount,
separatorBuilder: (_, __) => Container(
height: 1,
color: Theme.of(context).dividerColor,
),
separatorBuilder: (_, __) => const SectionDivider(),
itemBuilder: (context, index) {
final address = addresses[index];

View file

@ -1,6 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/src/widgets/standard_list.dart';
import 'package:cake_wallet/src/widgets/standart_switch.dart';
import 'package:cake_wallet/src/widgets/standard_switch.dart';
class SettingsSwitcherCell extends StandardListRow {
SettingsSwitcherCell(
@ -11,6 +11,6 @@ class SettingsSwitcherCell extends StandardListRow {
final void Function(BuildContext context, bool value)? onValueChange;
@override
Widget buildTrailing(BuildContext context) => StandartSwitch(
Widget buildTrailing(BuildContext context) => StandardSwitch(
value: value, onTaped: () => onValueChange?.call(context, !value));
}

View file

@ -1,6 +1,6 @@
import 'package:cake_wallet/src/widgets/standard_list.dart';
import 'package:cake_wallet/src/widgets/standart_list_card.dart';
import 'package:cake_wallet/src/widgets/standart_list_status_row.dart';
import 'package:cake_wallet/src/widgets/standard_list_card.dart';
import 'package:cake_wallet/src/widgets/standard_list_status_row.dart';
import 'package:cake_wallet/utils/show_bar.dart';
import 'package:cake_wallet/view_model/trade_details_view_model.dart';
import 'package:flutter/material.dart';
@ -9,7 +9,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/standart_list_row.dart';
import 'package:cake_wallet/src/widgets/list_row.dart';
import 'package:cake_wallet/src/screens/trade_details/track_trade_list_item.dart';
import 'package:cake_wallet/src/screens/trade_details/trade_details_list_card.dart';
import 'package:cake_wallet/src/screens/trade_details/trade_details_status_item.dart';
@ -62,18 +62,18 @@ class TradeDetailsPageBodyState extends State<TradeDetailsPageBody> {
if (item is TrackTradeListItem) {
return GestureDetector(
onTap: item.onTap,
child: StandartListRow(
child: ListRow(
title: '${item.title}', value: '${item.value}'));
}
if (item is DetailsListStatusItem) {
return StandartListStatusRow(
return StandardListStatusRow(
title: item.title,
value: item.value);
}
if (item is TradeDetailsListCardItem) {
return TradeDatailsStandartListCard(
return TradeDetailsStandardListCard(
id: item.id,
create: item.createdAt,
pair: item.pair,
@ -86,7 +86,7 @@ class TradeDetailsPageBodyState extends State<TradeDetailsPageBody> {
Clipboard.setData(ClipboardData(text: '${item.value}'));
showBar<void>(context, S.of(context).copied_to_clipboard);
},
child: StandartListRow(
child: ListRow(
title: '${item.title}', value: '${item.value}'));
});
});

View file

@ -6,7 +6,7 @@ import 'package:cake_wallet/view_model/transaction_details_view_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/standart_list_row.dart';
import 'package:cake_wallet/src/widgets/list_row.dart';
import 'package:cake_wallet/src/screens/transaction_details/blockexplorer_list_item.dart';
import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
@ -42,7 +42,7 @@ class TransactionDetailsPage extends BasePage {
S.of(context).transaction_details_copied(item.title));
},
child:
StandartListRow(title: '${item.title}:', value: item.value),
ListRow(title: '${item.title}:', value: item.value),
);
}
@ -50,7 +50,7 @@ class TransactionDetailsPage extends BasePage {
return GestureDetector(
onTap: item.onTap,
child:
StandartListRow(title: '${item.title}:', value: item.value),
ListRow(title: '${item.title}:', value: item.value),
);
}

View file

@ -5,7 +5,7 @@ import 'package:cake_wallet/src/widgets/standard_list.dart';
import 'package:cake_wallet/view_model/unspent_coins/unspent_coins_details_view_model.dart';
import 'package:cake_wallet/view_model/unspent_coins/unspent_coins_switch_item.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/src/widgets/standart_list_row.dart';
import 'package:cake_wallet/src/widgets/list_row.dart';
import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
@ -30,7 +30,7 @@ class UnspentCoinsDetailsPage extends BasePage {
final item = unspentCoinsDetailsViewModel.items[index];
if (item is StandartListItem) {
return StandartListRow(
return ListRow(
title: '${item.title}:',
value: item.value);
}

View file

@ -1,4 +1,4 @@
import 'package:cake_wallet/src/widgets/standart_switch.dart';
import 'package:cake_wallet/src/widgets/standard_switch.dart';
import 'package:flutter/material.dart';
class UnspentCoinsSwitchRow extends StatelessWidget {
@ -33,7 +33,7 @@ class UnspentCoinsSwitchRow extends StatelessWidget {
textAlign: TextAlign.left),
Padding(
padding: EdgeInsets.only(top: 12),
child: StandartSwitch(
child: StandardSwitch(
value: switchValue,
onTaped: () => onSwitchValueChange(!switchValue))
)

View file

@ -1,4 +1,5 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:cake_wallet/src/widgets/section_divider.dart';
import 'package:cake_wallet/utils/show_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
@ -6,7 +7,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/standart_list_row.dart';
import 'package:cake_wallet/src/widgets/list_row.dart';
import 'package:cake_wallet/view_model/wallet_keys_view_model.dart';
class WalletKeysPage extends BasePage {
@ -57,10 +58,7 @@ class WalletKeysPage extends BasePage {
height: 1,
padding: EdgeInsets.only(left: 24),
color: Theme.of(context).accentTextTheme!.headline6!.backgroundColor!,
child: Container(
height: 1,
color: Theme.of(context).dividerColor,
),
child: const SectionDivider(),
),
itemCount: walletKeysViewModel.items.length,
itemBuilder: (BuildContext context, int index) {
@ -71,7 +69,7 @@ class WalletKeysPage extends BasePage {
Clipboard.setData(ClipboardData(text: item.value));
showBar<void>(context, S.of(context).copied_key_to_clipboard(item.title));
},
child: StandartListRow(
child: ListRow(
title: item.title + ':',
value: item.value,
),

View file

@ -1,4 +1,5 @@
import 'dart:ui';
import 'package:cake_wallet/src/widgets/section_divider.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
@ -76,10 +77,7 @@ class BaseAlertDialog extends StatelessWidget {
),
)),
),
Container(
width: 1,
color: Theme.of(context).dividerColor,
),
const SectionDivider(),
Expanded(
child: TextButton(
onPressed: actionRight,
@ -140,10 +138,7 @@ class BaseAlertDialog extends StatelessWidget {
isDividerExists
? Padding(
padding: EdgeInsets.only(top: 16, bottom: 8),
child: Container(
height: 1,
color: Theme.of(context).dividerColor,
),
child: const SectionDivider(),
)
: Offstage(),
Padding(
@ -152,10 +147,7 @@ class BaseAlertDialog extends StatelessWidget {
)
],
),
Container(
height: 1,
color: Theme.of(context).dividerColor,
),
const SectionDivider(),
actionButtons(context)
],
),

View file

@ -1,8 +1,8 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class StandartListRow extends StatelessWidget {
StandartListRow(
class ListRow extends StatelessWidget {
ListRow(
{required this.title,
required this.value,
this.titleFontSize = 14,

View file

@ -0,0 +1,13 @@
import 'package:flutter/material.dart';
class SectionDivider extends StatelessWidget {
const SectionDivider();
@override
Widget build(BuildContext context) {
return Container(
height: 1,
color: Theme.of(context).dividerColor,
);
}
}

View file

@ -2,42 +2,42 @@ import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class StandardCheckbox extends StatefulWidget {
StandardCheckbox({
Key? key,
required this.value,
this.caption = '',
required this.onChanged})
: super(key: key);
class StandardCheckbox extends StatelessWidget {
StandardCheckbox(
{required this.value,
this.caption = '',
this.gradientBackground = false,
this.borderColor,
this.iconColor,
required this.onChanged});
final bool value;
final String caption;
final bool gradientBackground;
final Color? borderColor;
final Color? iconColor;
final Function(bool) onChanged;
@override
StandardCheckboxState createState() =>
StandardCheckboxState(value, caption, onChanged);
}
class StandardCheckboxState extends State<StandardCheckbox> {
StandardCheckboxState(this.value, this.caption, this.onChanged);
bool value;
String caption;
Function(bool) onChanged;
void changeValue(bool newValue) {
setState(() => value = newValue);
}
@override
Widget build(BuildContext context) {
final baseGradient = LinearGradient(colors: [
Theme.of(context).primaryTextTheme.subtitle1!.color!,
Theme.of(context).primaryTextTheme.subtitle1!.decorationColor!,
], begin: Alignment.centerLeft, end: Alignment.centerRight);
final boxBorder = Border.all(
color: borderColor ?? Theme.of(context).primaryTextTheme.caption!.color!, width: 1.0);
final checkedBoxDecoration = BoxDecoration(
gradient: gradientBackground ? baseGradient : null,
border: gradientBackground ? null : boxBorder,
borderRadius: BorderRadius.all(Radius.circular(8.0)));
final uncheckedBoxDecoration =
BoxDecoration(border: boxBorder, borderRadius: BorderRadius.all(Radius.circular(8.0)));
return GestureDetector(
onTap: () {
value = !value;
onChanged(value);
setState(() {});
},
onTap: () => onChanged(!value),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
@ -45,38 +45,25 @@ class StandardCheckboxState extends State<StandardCheckbox> {
Container(
height: 24.0,
width: 24.0,
decoration: BoxDecoration(
border: Border.all(
color: Theme.of(context)
.primaryTextTheme!
.caption!
.color!,
width: 1.0),
borderRadius: BorderRadius.all(
Radius.circular(8.0)),
color: Theme.of(context).backgroundColor),
decoration: value ? checkedBoxDecoration : uncheckedBoxDecoration,
child: value
? Icon(
Icons.check,
color: Colors.blue,
size: 20.0,
)
: Offstage(),
? Icon(
Icons.check,
color: iconColor ?? Colors.blue,
size: 20.0,
)
: Offstage(),
),
if (caption.isNotEmpty) Padding(
padding: EdgeInsets.only(left: 10),
child: Text(
caption,
style: TextStyle(
fontSize: 16.0,
color: Theme.of(context)
.primaryTextTheme!
.headline6!
.color!),
)
)
if (caption.isNotEmpty)
Padding(
padding: EdgeInsets.only(left: 10),
child: Text(
caption,
style: TextStyle(
fontSize: 16.0, color: Theme.of(context).primaryTextTheme!.headline6!.color!),
))
],
),
);
}
}
}

View file

@ -1,6 +1,6 @@
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/widgets/standart_list_card.dart';
import 'package:cake_wallet/src/widgets/standart_list_status_row.dart';
import 'package:cake_wallet/src/widgets/standard_list_card.dart';
import 'package:cake_wallet/src/widgets/standard_list_status_row.dart';
import 'package:flutter/material.dart';
class StandardListRow extends StatelessWidget {
@ -217,7 +217,7 @@ class SectionStandardList extends StatelessWidget {
return Container();
}
if (row is StandartListStatusRow || row is TradeDatailsStandartListCard) {
if (row is StandardListStatusRow || row is TradeDetailsStandardListCard) {
return Container();
}

View file

@ -2,8 +2,8 @@ import 'package:cake_wallet/palette.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/themes/theme_base.dart';
class TradeDatailsStandartListCard extends StatelessWidget {
TradeDatailsStandartListCard(
class TradeDetailsStandardListCard extends StatelessWidget {
TradeDetailsStandardListCard(
{required this.id,
required this.create,
required this.pair,

View file

@ -3,8 +3,8 @@ import 'package:cake_wallet/src/screens/dashboard/widgets/sync_indicator_icon.da
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class StandartListStatusRow extends StatelessWidget {
StandartListStatusRow({required this.title, required this.value});
class StandardListStatusRow extends StatelessWidget {
StandardListStatusRow({required this.title, required this.value});
final String title;
final String value;

View file

@ -1,17 +1,17 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class StandartSwitch extends StatefulWidget {
const StandartSwitch({required this.value, required this.onTaped});
class StandardSwitch extends StatefulWidget {
const StandardSwitch({required this.value, required this.onTaped});
final bool value;
final VoidCallback onTaped;
@override
StandartSwitchState createState() => StandartSwitchState();
StandardSwitchState createState() => StandardSwitchState();
}
class StandartSwitchState extends State<StandartSwitch> {
class StandardSwitchState extends State<StandardSwitch> {
@override
Widget build(BuildContext context) {
return GestureDetector(

View file

@ -8,12 +8,11 @@ part'trade_filter_store.g.dart';
class TradeFilterStore = TradeFilterStoreBase with _$TradeFilterStore;
abstract class TradeFilterStoreBase with Store {
TradeFilterStoreBase(
{this.displayXMRTO = true,
this.displayChangeNow = true,
this.displayMorphToken = true,
this.displaySimpleSwap = true,
});
TradeFilterStoreBase() : displayXMRTO = true,
displayChangeNow = true,
displaySideShift = true,
displayMorphToken = true,
displaySimpleSwap = true;
@observable
bool displayXMRTO;
@ -21,26 +20,50 @@ abstract class TradeFilterStoreBase with Store {
@observable
bool displayChangeNow;
@observable
bool displaySideShift;
@observable
bool displayMorphToken;
@observable
bool displaySimpleSwap;
@computed
bool get displayAllTrades => displayChangeNow && displaySideShift && displaySimpleSwap;
@action
void toggleDisplayExchange(ExchangeProviderDescription provider) {
switch (provider) {
case ExchangeProviderDescription.changeNow:
displayChangeNow = !displayChangeNow;
break;
case ExchangeProviderDescription.sideShift:
displaySideShift = !displaySideShift;
break;
case ExchangeProviderDescription.simpleSwap:
displaySimpleSwap = !displaySimpleSwap;
break;
case ExchangeProviderDescription.xmrto:
displayXMRTO = !displayXMRTO;
break;
case ExchangeProviderDescription.morphToken:
displayMorphToken = !displayMorphToken;
break;
case ExchangeProviderDescription.simpleSwap:
displaySimpleSwap = !displaySimpleSwap;
case ExchangeProviderDescription.all:
if (displayAllTrades) {
displayChangeNow = false;
displaySideShift = false;
displayXMRTO = false;
displayMorphToken = false;
displaySimpleSwap = false;
} else {
displayChangeNow = true;
displaySideShift = true;
displayXMRTO = true;
displayMorphToken = true;
displaySimpleSwap = true;
}
break;
}
}
@ -48,13 +71,15 @@ abstract class TradeFilterStoreBase with Store {
List<TradeListItem> filtered({required List<TradeListItem> trades, required WalletBase wallet}) {
final _trades =
trades.where((item) => item.trade.walletId == wallet.id).toList();
final needToFilter = !displayChangeNow || !displayXMRTO || !displayMorphToken || !displaySimpleSwap;
final needToFilter = !displayAllTrades;
return needToFilter
? _trades
.where((item) =>
(displayXMRTO &&
item.trade.provider == ExchangeProviderDescription.xmrto) ||
(displaySideShift &&
item.trade.provider == ExchangeProviderDescription.sideShift) ||
(displayChangeNow &&
item.trade.provider ==
ExchangeProviderDescription.changeNow) ||

View file

@ -1,6 +1,8 @@
import 'package:mobx/mobx.dart';
import 'package:cw_core/transaction_direction.dart';
import 'package:cake_wallet/view_model/dashboard/transaction_list_item.dart';
import 'package:cake_wallet/view_model/dashboard/filter_item.dart';
import 'package:cake_wallet/generated/i18n.dart';
part 'transaction_filter_store.g.dart';
@ -8,8 +10,8 @@ class TransactionFilterStore = TransactionFilterStoreBase
with _$TransactionFilterStore;
abstract class TransactionFilterStoreBase with Store {
TransactionFilterStoreBase(
{this.displayIncoming = true, this.displayOutgoing = true});
TransactionFilterStoreBase() : displayIncoming = true,
displayOutgoing = true;
@observable
bool displayIncoming;
@ -23,11 +25,31 @@ abstract class TransactionFilterStoreBase with Store {
@observable
DateTime? endDate;
@action
void toggleIncoming() => displayIncoming = !displayIncoming;
@computed
bool get displayAll => displayIncoming && displayOutgoing;
@action
void toggleOutgoing() => displayOutgoing = !displayOutgoing;
void toggleAll() {
if (displayAll) {
displayOutgoing = false;
displayIncoming = false;
} else {
displayOutgoing = true;
displayIncoming = true;
}
}
@action
void toggleIncoming() {
displayIncoming = !displayIncoming;
}
@action
void toggleOutgoing() {
displayOutgoing = !displayOutgoing;
}
@action
void changeStartDate(DateTime date) => startDate = date;
@ -37,8 +59,7 @@ abstract class TransactionFilterStoreBase with Store {
List<TransactionListItem> filtered({required List<TransactionListItem> transactions}) {
var _transactions = <TransactionListItem>[];
final needToFilter = !displayOutgoing ||
!displayIncoming ||
final needToFilter = !displayAll ||
(startDate != null && endDate != null);
if (needToFilter) {
@ -50,7 +71,7 @@ abstract class TransactionFilterStoreBase with Store {
&& (endDate?.isAfter(item.transaction.date) ?? false);
}
if (allowed && (!displayOutgoing || !displayIncoming)) {
if (allowed && (!displayAll)) {
allowed = (displayOutgoing &&
item.transaction.direction ==
TransactionDirection.outgoing) ||

View file

@ -58,25 +58,44 @@ abstract class DashboardViewModelBase with Store {
isShowThirdYatIntroduction = false,
filterItems = {
S.current.transactions: [
FilterItem(
value: () => transactionFilterStore.displayAll,
caption: S.current.all_transactions,
onChanged: transactionFilterStore.toggleAll),
FilterItem(
value: () => transactionFilterStore.displayIncoming,
caption: S.current.incoming,
onChanged: (value) => transactionFilterStore.toggleIncoming()),
onChanged:transactionFilterStore.toggleIncoming),
FilterItem(
value: () => transactionFilterStore.displayOutgoing,
caption: S.current.outgoing,
onChanged: (value) => transactionFilterStore.toggleOutgoing()),
onChanged: transactionFilterStore.toggleOutgoing),
// FilterItem(
// value: () => false,
// caption: S.current.transactions_by_date,
// onChanged: null),
],
S.current.trades: [
FilterItem(
value: () => tradeFilterStore.displayAllTrades,
caption: S.current.all_trades,
onChanged: () => tradeFilterStore
.toggleDisplayExchange(ExchangeProviderDescription.all)),
FilterItem(
value: () => tradeFilterStore.displayChangeNow,
caption: 'Change.NOW',
onChanged: (value) => tradeFilterStore
caption: ExchangeProviderDescription.changeNow.title,
onChanged: () => tradeFilterStore
.toggleDisplayExchange(ExchangeProviderDescription.changeNow)),
FilterItem(
value: () => tradeFilterStore.displaySideShift,
caption: ExchangeProviderDescription.sideShift.title,
onChanged: () => tradeFilterStore
.toggleDisplayExchange(ExchangeProviderDescription.sideShift)),
FilterItem(
value: () => tradeFilterStore.displaySimpleSwap,
caption: ExchangeProviderDescription.simpleSwap.title,
onChanged: () => tradeFilterStore
.toggleDisplayExchange(ExchangeProviderDescription.simpleSwap)),
]
},
subname = '',

View file

@ -1,3 +1,5 @@
import 'package:mobx/mobx.dart';
class FilterItem {
FilterItem({
required this.value,
@ -6,5 +8,5 @@ class FilterItem {
bool Function() value;
String caption;
Function(bool) onChanged;
Function onChanged;
}

View file

@ -48,7 +48,7 @@
"outgoing" : "Ausgehend",
"transactions_by_date" : "Transaktionen nach Datum",
"trades" : "Börsen",
"filters" : "Filter",
"filter_by": "Filtern nach",
"today" : "Heute",
"yesterday" : "Gestern",
"received" : "Empfangen",
@ -656,6 +656,8 @@
"use_suggested": "Vorgeschlagen verwenden",
"do_not_share_warning_text" : "Teilen Sie diese nicht mit anderen, einschließlich Support.\n\nIhr Geld kann und wird gestohlen werden!",
"help": "hilfe",
"all_transactions": "Alle Transaktionen",
"all_trades": "Alle Gewerke",
"connection_sync": "Verbindung und Synchronisierung",
"security_and_backup": "Sicherheit und Datensicherung",
"create_backup": "Backup erstellen",

View file

@ -48,7 +48,7 @@
"outgoing" : "Outgoing",
"transactions_by_date" : "Transactions by date",
"trades" : "Trades",
"filters" : "Filter",
"filter_by": "Filter by",
"today" : "Today",
"yesterday" : "Yesterday",
"received" : "Received",
@ -656,6 +656,8 @@
"use_suggested": "Use Suggested",
"do_not_share_warning_text" : "Do not share these with anyone else, including support.\n\nYour funds can and will be stolen!",
"help": "help",
"all_transactions": "All transactions",
"all_trades": "All trades",
"connection_sync": "Connection and sync",
"security_and_backup": "Security and backup",
"create_backup": "Create backup",

View file

@ -48,7 +48,7 @@
"outgoing" : "Saliente",
"transactions_by_date" : "Transacciones por fecha",
"trades" : "Cambios",
"filters" : "Filtrar",
"filter_by": "Filtrado por",
"today" : "Hoy",
"yesterday" : "Ayer",
"received" : "Recibido",
@ -656,6 +656,8 @@
"use_suggested": "Usar sugerido",
"do_not_share_warning_text" : "No comparta estos con nadie más, incluido el soporte.\n\n¡Sus fondos pueden ser y serán robados!",
"help": "ayuda",
"all_transactions": "Todas las transacciones",
"all_trades": "Todos los oficios",
"connection_sync": "Conexión y sincronización",
"security_and_backup": "Seguridad y respaldo",
"create_backup": "Crear copia de seguridad",

View file

@ -46,7 +46,7 @@
"outgoing" : "Sortantes",
"transactions_by_date" : "Transactions par date",
"trades" : "Échanges",
"filters" : "Filtre",
"filter_by": "Filtrer par",
"today" : "Aujourd'hui",
"yesterday" : "Hier",
"received" : "Reçus",
@ -654,6 +654,8 @@
"use_suggested": "Utilisation suggérée",
"do_not_share_warning_text" : "Ne les partagez avec personne d'autre, y compris avec l'assistance.\n\nVos fonds peuvent et seront volés!",
"help": "aider",
"all_transactions": "Toutes transactions",
"all_trades": "Tous métiers",
"connection_sync": "Connexion et synchronisation",
"security_and_backup": "Sécurité et sauvegarde",
"create_backup": "Créer une sauvegarde",

View file

@ -48,7 +48,7 @@
"outgoing" : "निवर्तमान",
"transactions_by_date" : "तारीख से लेन-देन",
"trades" : "ट्रेडों",
"filters" : "फ़िल्टर",
"filter_by": "के द्वारा छनित",
"today" : "आज",
"yesterday" : "बिता कल",
"received" : "प्राप्त किया",
@ -656,6 +656,8 @@
"use_suggested": "सुझाए गए का प्रयोग करें",
"do_not_share_warning_text" : "समर्थन सहित, इन्हें किसी और के साथ साझा न करें।\n\nआपके धन की चोरी हो सकती है और होगी!",
"help": "मदद करना",
"all_transactions": "सभी लेन - देन",
"all_trades": "सभी व्यापार",
"connection_sync": "कनेक्शन और सिंक",
"security_and_backup": "सुरक्षा और बैकअप",
"create_backup": "बैकअप बनाएँ",
@ -670,6 +672,7 @@
"advanced_privacy_settings": "उन्नत गोपनीयता सेटिंग्स",
"settings_can_be_changed_later": "इन सेटिंग्स को बाद में ऐप सेटिंग में बदला जा सकता है",
"add_custom_node": "नया कस्टम नोड जोड़ें",
"disable_fiat": "िएट को अक्षम करें",
"fiat_api": "फिएट पैसे API",
"disabled": "अक्षम",
"enabled": "सक्रिय",

View file

@ -48,7 +48,7 @@
"outgoing" : "Odlazno",
"transactions_by_date" : "Transakcije prema datumu",
"trades" : "Razmjene",
"filters" : "Filter",
"filter_by": "Filtrirati po",
"today" : "Danas",
"yesterday" : "Jučer",
"received" : "Primljeno",
@ -656,6 +656,8 @@
"use_suggested": "Koristite predloženo",
"do_not_share_warning_text" : "Nemojte ih dijeliti ni s kim, uključujući podršku.\n\nVaša sredstva mogu i bit će ukradena!",
"help": "pomozite",
"all_transactions": "Sve transakcije",
"all_trades": "Svi obrti",
"connection_sync": "Povezivanje i sinkronizacija",
"security_and_backup": "Sigurnost i sigurnosna kopija",
"create_backup": "Stvori sigurnosnu kopiju",

View file

@ -48,7 +48,7 @@
"outgoing" : "In uscita",
"transactions_by_date" : "Transazioni per data",
"trades" : "Scambi",
"filters" : "Filtri",
"filter_by": "Filtrirati po",
"today" : "Oggi",
"yesterday" : "Ieri",
"received" : "Ricevuto",
@ -656,6 +656,8 @@
"use_suggested": "Usa suggerito",
"do_not_share_warning_text" : "Non condividerli con nessun altro, incluso il supporto.\n\nI tuoi fondi possono e saranno rubati!",
"help": "aiuto",
"all_transactions": "Sve transakcije",
"all_trades": "Svi obrti",
"connection_sync": "Connessione e sincronizzazione",
"security_and_backup": "Sicurezza e backup",
"create_backup": "Crea backup",

View file

@ -48,7 +48,7 @@
"outgoing" : "発信",
"transactions_by_date" : "日付ごとの取引",
"trades" : "取引",
"filters" : "フィルタ",
"filter_by": "でフィルタリング",
"today" : "今日",
"yesterday" : "昨日",
"received" : "受け取った",
@ -656,6 +656,8 @@
"use_suggested": "推奨を使用",
"do_not_share_warning_text" : "サポートを含め、これらを他の誰とも共有しないでください。\n\nあなたの資金は盗まれる可能性があります!",
"help": "ヘルプ",
"all_transactions": "全取引",
"all_trades": "すべての取引",
"connection_sync": "接続と同期",
"security_and_backup": "セキュリティとバックアップ",
"create_backup": "バックアップを作成",

View file

@ -48,7 +48,7 @@
"outgoing" : "나가는",
"transactions_by_date" : "날짜 별 거래",
"trades" : "거래",
"filters" : "필터",
"filter_by": "필터링 기준",
"today" : "오늘",
"yesterday" : "어제",
"received" : "받았습니다",
@ -656,6 +656,8 @@
"use_suggested": "추천 사용",
"do_not_share_warning_text" : "지원을 포함하여 다른 사람과 이러한 정보를 공유하지 마십시오.\n\n귀하의 자금은 도난당할 수 있고 도난당할 수 있습니다!",
"help": "돕다",
"all_transactions": "모든 거래 창구",
"all_trades": "A모든 거래",
"connection_sync": "연결 및 동기화",
"security_and_backup": "보안 및 백업",
"create_backup": "백업 생성",

View file

@ -48,7 +48,7 @@
"outgoing" : "Uitgaande",
"transactions_by_date" : "Transacties op datum",
"trades" : "Trades",
"filters" : "Filter",
"filter_by": "Filteren op",
"today" : "Vandaag",
"yesterday" : "Gisteren",
"received" : "Ontvangen",
@ -656,6 +656,8 @@
"use_suggested": "Gebruik aanbevolen",
"do_not_share_warning_text" : "Deel deze met niemand anders, ook niet met support.\n\nUw geld kan en zal worden gestolen!",
"help": "helpen",
"all_transactions": "Alle transacties",
"all_trades": "Alle transacties",
"connection_sync": "Verbinding en synchronisatie",
"security_and_backup": "Beveiliging en back-up",
"create_backup": "Maak een back-up",

View file

@ -48,7 +48,7 @@
"outgoing" : "Towarzyski",
"transactions_by_date" : "Transakcje według daty",
"trades" : "Transakcje",
"filters" : "Filtr",
"filter_by": "Filtruj według",
"today" : "Dzisiaj",
"yesterday" : "Wczoraj",
"received" : "Odebrane",
@ -656,6 +656,8 @@
"use_suggested": "Użyj sugerowane",
"do_not_share_warning_text" : "Nie udostępniaj ich nikomu innemu, w tym pomocy.\n\nTwoje środki mogą i zostaną skradzione!",
"help": "pomoc",
"all_transactions": "Wszystkie transakcje",
"all_trades": "Wszystkie operacje",
"connection_sync": "Połączenie i synchronizacja",
"security_and_backup": "Bezpieczeństwo i kopia zapasowa",
"create_backup": "Utwórz kopię zapasową",

View file

@ -48,7 +48,7 @@
"outgoing" : "Enviadas",
"transactions_by_date" : "Transações por data",
"trades" : "Trocas",
"filters" : "Filtro",
"filter_by": "Filtrar por",
"today" : "Hoje",
"yesterday" : "Ontem",
"received" : "Recebida",
@ -655,6 +655,8 @@
"use_suggested": "Uso sugerido",
"do_not_share_warning_text" : "Não os compartilhe com mais ninguém, incluindo suporte.\n\nSeus fundos podem e serão roubados!",
"help": "ajuda",
"all_transactions": "Todas as transacções",
"all_trades": "Todas as negociações",
"connection_sync": "Conexão e sincronização",
"security_and_backup": "Segurança e backup",
"create_backup": "Criar backup",

View file

@ -48,7 +48,7 @@
"outgoing" : "Исходящие",
"transactions_by_date" : "Сортировать по дате",
"trades" : "Сделки",
"filters" : "Фильтр",
"filter_by": "Фильтровать по",
"today" : "Сегодня",
"yesterday" : "Вчера",
"received" : "Полученные",
@ -656,6 +656,8 @@
"use_suggested": "Использовать предложенный",
"do_not_share_warning_text" : "Не сообщайте их никому, включая техподдержку.\n\nВаши средства могут и будут украдены!",
"help": "помощь",
"all_transactions": "Все транзакции",
"all_trades": "Все сделки",
"connection_sync": "Подключение и синхронизация",
"security_and_backup": "Безопасность и резервное копирование",
"create_backup": "Создать резервную копию",

View file

@ -48,7 +48,7 @@
"outgoing" : "Вихідні",
"transactions_by_date" : "Сортувати по даті",
"trades" : "Торгові операції",
"filters" : "Фільтр",
"filter_by": "Фільтрувати по",
"today" : "Сьогодні",
"yesterday" : "Вчора",
"received" : "Отримані",
@ -655,6 +655,8 @@
"use_suggested": "Використати запропоноване",
"do_not_share_warning_text" : "Не діліться цим нікому, включно зі службою підтримки.\n\nВаші кошти можуть і будуть вкрадені!",
"help": "допомога",
"all_transactions": "Всі транзакції",
"all_trades": "Всі операції",
"connection_sync": "Підключення та синхронізація",
"security_and_backup": "Безпека та резервне копіювання",
"create_backup": "Створити резервну копію",

View file

@ -48,7 +48,7 @@
"outgoing" : "发送",
"transactions_by_date" : "按日期交易",
"trades" : "交易",
"filters" : "过滤",
"filter_by": "过滤",
"today" : "今天",
"yesterday" : "昨天",
"received" : "已收到",
@ -654,6 +654,8 @@
"use_suggested": "使用建议",
"do_not_share_warning_text" : "请勿与其他任何人分享这些信息,包括支持人员。\n\n您的资金可能而且将会被盗",
"help": "帮助",
"all_transactions": "所有交易",
"all_trades": "所有的变化",
"connection_sync": "连接和同步",
"security_and_backup": "安全和备份",
"create_backup": "创建备份",