From 1f08d8747159a6455a637544714bf69bf9d9eb8b Mon Sep 17 00:00:00 2001 From: Serhii Date: Thu, 10 Nov 2022 13:25:03 +0200 Subject: [PATCH 01/14] Rework filter on the transactions list screen --- .../exchange_provider_description.dart | 5 + .../dashboard/widgets/filter_tile.dart | 7 +- .../dashboard/widgets/filter_widget.dart | 231 ++++++++++-------- lib/src/widgets/rounded_checkbox.dart | 91 +++++++ lib/store/dashboard/trade_filter_store.dart | 82 ++++--- .../dashboard/transaction_filter_store.dart | 57 +++-- .../dashboard/dashboard_view_model.dart | 28 ++- lib/view_model/dashboard/filter_item.dart | 6 +- 8 files changed, 350 insertions(+), 157 deletions(-) create mode 100644 lib/src/widgets/rounded_checkbox.dart diff --git a/lib/exchange/exchange_provider_description.dart b/lib/exchange/exchange_provider_description.dart index f9e359454..2fd231085 100644 --- a/lib/exchange/exchange_provider_description.dart +++ b/lib/exchange/exchange_provider_description.dart @@ -24,6 +24,9 @@ class ExchangeProviderDescription extends EnumerableItem 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 return sideShift; case 4: return simpleSwap; + case 5: + return all; default: throw Exception('Unexpected token: $raw for ExchangeProviderDescription deserialize'); } diff --git a/lib/src/screens/dashboard/widgets/filter_tile.dart b/lib/src/screens/dashboard/widgets/filter_tile.dart index 9a5646ac9..3be96073a 100644 --- a/lib/src/screens/dashboard/widgets/filter_tile.dart +++ b/lib/src/screens/dashboard/widgets/filter_tile.dart @@ -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, ); } diff --git a/lib/src/screens/dashboard/widgets/filter_widget.dart b/lib/src/screens/dashboard/widgets/filter_widget.dart index 98d5add81..8719df562 100644 --- a/lib/src/screens/dashboard/widgets/filter_widget.dart +++ b/lib/src/screens/dashboard/widgets/filter_widget.dart @@ -6,20 +6,21 @@ 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/src/widgets/rounded_checkbox.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 = SectionDivider(); return AlertBackground( child: Stack( alignment: Alignment.center, @@ -38,118 +39,150 @@ class FilterWidget extends StatelessWidget { ), ), 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!, - ), - itemBuilder: (_, index1) { - final title = dashboardViewModel.filterItems.keys.elementAt(index1); - final section = dashboardViewModel.filterItems.values.elementAt(index1); - - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - 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 - ), + color: Theme.of(context) + .textTheme! + .bodyText1! + .decorationColor!, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(24.0), + child: Text( + S.of(context).filters, + style: TextStyle( + color: Theme.of(context) + .textTheme! + .bodyText1! + .decorationColor!, + fontSize: 16, + fontFamily: 'Lato', + 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 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), + ), + 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: [ + Padding( + padding: EdgeInsets.only( + top: 20, left: 24, right: 24), child: Text( - item.caption, + title, style: TextStyle( - color: Theme.of(context).primaryTextTheme!.headline6!.color!, - fontSize: 18, + color: Theme.of(context) + .primaryTextTheme! + .headline6! + .color!, + fontSize: 16, fontFamily: 'Lato', - fontWeight: FontWeight.w500, - decoration: TextDecoration.none - ), + fontWeight: FontWeight.bold, + decoration: TextDecoration.none), ), ), - ); + ListView.builder( + padding: + EdgeInsets.symmetric(vertical: 8.0), + shrinkWrap: true, + physics: + const NeverScrollableScrollPhysics(), + itemCount: section.length, + itemBuilder: (_, index2) { + final item = section[index2]; + final content = item.onChanged != null + ? Observer( + builder: (_) => + RoundedCheckboxWidget( + value: item.value.value, + caption: item.caption, + onChanged: item.onChanged, + currentTheme: + dashboardViewModel + .settingsStore + .currentTheme, + )) + : GestureDetector( + onTap: () async { + //final List 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))); - return FilterTile(child: content); - }, - ) - ], - ); - }, - ), + //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: Colors.red, + //Theme.of(context).primaryTextTheme.title.color,// + fontSize: 18, + fontFamily: 'Lato', + fontWeight: + FontWeight.w500, + decoration: + TextDecoration.none), + ), + ), + ); + + return FilterTile(child: content); + }, + ) + ], + ); + }, + ), + ]), ), ), ), ], ), - AlertCloseButton(image: backVector) + AlertCloseButton(image: closeIcon) ], ), ); } +} + +class SectionDivider extends StatelessWidget { + const SectionDivider(); + + @override + Widget build(BuildContext context) { + return Container( + height: 1, + color: Colors.red,//Fixme Theme.of(context).accentTextTheme.subhead.backgroundColor, + ); + } } \ No newline at end of file diff --git a/lib/src/widgets/rounded_checkbox.dart b/lib/src/widgets/rounded_checkbox.dart new file mode 100644 index 000000000..6e5b08f1e --- /dev/null +++ b/lib/src/widgets/rounded_checkbox.dart @@ -0,0 +1,91 @@ +import 'package:cake_wallet/palette.dart'; +import 'package:flutter/material.dart'; +import 'package:cake_wallet/themes/theme_base.dart'; + +class RoundedCheckboxWidget extends StatelessWidget { + RoundedCheckboxWidget( + {required this.value, + required this.caption, + required this.onChanged, + this.currentTheme}); + + final bool value; + final String caption; + final Function onChanged; + final ThemeBase? currentTheme; + + bool get darkTheme => currentTheme!.type == ThemeType.dark; + + @override + Widget build(BuildContext context) { + + final baseGradient = LinearGradient(colors: [ + Colors.red, //Fixme Theme.of(context).primaryTextTheme!.subtitle!.color!, + Colors.red //Fixme Theme.of(context).primaryTextTheme!.subtitle!.decorationColor!, + ], begin: Alignment.centerLeft, end: Alignment.centerRight); + + final darkThemeGradient = LinearGradient(colors: [ + Palette.blueCraiola, + Palette.blueGreyCraiola, + ], begin: Alignment.topLeft, end: Alignment.bottomRight); + + final gradient = darkTheme ? darkThemeGradient : baseGradient; + + final uncheckedColor = darkTheme + ? Colors.red //Fixme Theme.of(context).accentTextTheme.subhead.decorationColor + : Colors.white; + + final borderColor = darkTheme + ? Colors.red //Fixme Theme.of(context).accentTextTheme.subtitle.backgroundColor + : Colors.transparent; + + final checkedOuterBoxDecoration = + BoxDecoration(shape: BoxShape.circle, gradient: gradient); + final outerBoxDecoration = BoxDecoration( + shape: BoxShape.circle, + color: Theme.of(context).accentTextTheme.overline!.color!, + border: Border.all(color: borderColor)); + + final checkedInnerBoxDecoration = + BoxDecoration(shape: BoxShape.circle, color: Colors.white); + final innerBoxDecoration = + BoxDecoration(shape: BoxShape.circle, color: uncheckedColor); + + return GestureDetector( + onTap: () => onChanged(), + child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + height: 24.0, + width: 24.0, + child: DecoratedBox( + decoration: + value ? checkedOuterBoxDecoration : outerBoxDecoration, + child: Padding( + padding: EdgeInsets.all(value ? 4.0 : 1.0), + child: DecoratedBox( + decoration: + value ? checkedInnerBoxDecoration : innerBoxDecoration, + ), + ), + ), + ), + Padding( + padding: EdgeInsets.only(left: 16), + child: Text( + caption, + style: TextStyle( + color: Colors.red, //Fixme Theme.of(context).primaryTextTheme.title.color, + fontSize: 18, + fontFamily: 'Lato', + fontWeight: FontWeight.w500, + decoration: TextDecoration.none), + ), + ) + ], + ), + ); + } +} \ No newline at end of file diff --git a/lib/store/dashboard/trade_filter_store.dart b/lib/store/dashboard/trade_filter_store.dart index bee63b21e..4319c3bc7 100644 --- a/lib/store/dashboard/trade_filter_store.dart +++ b/lib/store/dashboard/trade_filter_store.dart @@ -8,39 +8,61 @@ 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(); - @observable - bool displayXMRTO; - - @observable - bool displayChangeNow; - - @observable - bool displayMorphToken; - - @observable - bool displaySimpleSwap; + Observable displayXMRTO = Observable(true); + Observable displayAllTrades = Observable(true); + Observable displayChangeNow = Observable(true); + Observable displaySideShift = Observable(true); + Observable displayMorphToken = Observable(true); + Observable displaySimpleSwap = Observable(true); @action void toggleDisplayExchange(ExchangeProviderDescription provider) { switch (provider) { case ExchangeProviderDescription.changeNow: - displayChangeNow = !displayChangeNow; + displayAllTrades.value = false; + displayChangeNow.value = !displayChangeNow.value; + if (displayChangeNow.value && displaySideShift.value && displaySimpleSwap.value) { + displayAllTrades.value = true; + } break; - case ExchangeProviderDescription.xmrto: - displayXMRTO = !displayXMRTO; - break; - case ExchangeProviderDescription.morphToken: - displayMorphToken = !displayMorphToken; + case ExchangeProviderDescription.sideShift: + displayAllTrades.value = false; + displaySideShift.value = !displaySideShift.value; + if (displayChangeNow.value && displaySideShift.value && displaySimpleSwap.value) { + displayAllTrades.value = true; + } break; case ExchangeProviderDescription.simpleSwap: - displaySimpleSwap = !displaySimpleSwap; + displayAllTrades.value = false; + displaySimpleSwap.value = !displaySimpleSwap.value; + if (displayChangeNow.value && displaySideShift.value && displaySimpleSwap.value) { + displayAllTrades.value = true; + } + break; + case ExchangeProviderDescription.xmrto: + displayXMRTO.value = !displayXMRTO.value; + break; + case ExchangeProviderDescription.morphToken: + displayMorphToken.value = !displayMorphToken.value; + break; + case ExchangeProviderDescription.all: + displayAllTrades.value = !displayAllTrades.value; + if (displayAllTrades.value) { + displayChangeNow.value = true; + displaySideShift.value = true; + displayXMRTO.value = true; + displayMorphToken.value = true; + displaySimpleSwap.value = true; + } + if (!displayAllTrades.value) { + displayChangeNow.value = false; + displaySideShift.value = false; + displayXMRTO.value = false; + displayMorphToken.value = false; + displaySimpleSwap.value = false; + } break; } } @@ -48,20 +70,22 @@ abstract class TradeFilterStoreBase with Store { List filtered({required List trades, required WalletBase wallet}) { final _trades = trades.where((item) => item.trade.walletId == wallet.id).toList(); - final needToFilter = !displayChangeNow || !displayXMRTO || !displayMorphToken || !displaySimpleSwap; + final needToFilter = !displayChangeNow.value || !displaySideShift.value + || !displayXMRTO.value || !displayMorphToken.value + || !displaySimpleSwap.value; return needToFilter ? _trades .where((item) => - (displayXMRTO && + (displayXMRTO.value && item.trade.provider == ExchangeProviderDescription.xmrto) || - (displayChangeNow && + (displayChangeNow.value && item.trade.provider == ExchangeProviderDescription.changeNow) || - (displayMorphToken && + (displayMorphToken.value && item.trade.provider == ExchangeProviderDescription.morphToken) - ||(displaySimpleSwap && + ||(displaySimpleSwap.value && item.trade.provider == ExchangeProviderDescription.simpleSwap)) .toList() diff --git a/lib/store/dashboard/transaction_filter_store.dart b/lib/store/dashboard/transaction_filter_store.dart index 4444075b7..4198f7d8c 100644 --- a/lib/store/dashboard/transaction_filter_store.dart +++ b/lib/store/dashboard/transaction_filter_store.dart @@ -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,14 +10,11 @@ class TransactionFilterStore = TransactionFilterStoreBase with _$TransactionFilterStore; abstract class TransactionFilterStoreBase with Store { - TransactionFilterStoreBase( - {this.displayIncoming = true, this.displayOutgoing = true}); + TransactionFilterStoreBase(); - @observable - bool displayIncoming; - - @observable - bool displayOutgoing; + Observable displayAll = Observable(true); + Observable displayIncoming = Observable(true); + Observable displayOutgoing = Observable(true); @observable DateTime? startDate; @@ -24,10 +23,40 @@ abstract class TransactionFilterStoreBase with Store { DateTime? endDate; @action - void toggleIncoming() => displayIncoming = !displayIncoming; + void toggleIAll() { + displayAll.value = (!displayAll.value); + if (displayAll.value) { + displayOutgoing.value = true; + displayIncoming.value = true; + } + if (!displayAll.value) { + displayOutgoing.value = false; + displayIncoming.value = false; + } + } @action - void toggleOutgoing() => displayOutgoing = !displayOutgoing; + void toggleIncoming() { + displayIncoming.value = (!displayIncoming.value); + if (displayIncoming.value && displayOutgoing.value) { + displayAll.value = true; + } + if (!displayIncoming.value || !displayOutgoing.value) { + displayAll.value = false; + } + } + + + @action + void toggleOutgoing() { + displayOutgoing.value = (!displayOutgoing.value); + if (displayIncoming.value && displayOutgoing.value) { + displayAll.value = true; + } + if (!displayIncoming.value || !displayOutgoing.value) { + displayAll.value = false; + } + } @action void changeStartDate(DateTime date) => startDate = date; @@ -37,8 +66,8 @@ abstract class TransactionFilterStoreBase with Store { List filtered({required List transactions}) { var _transactions = []; - final needToFilter = !displayOutgoing || - !displayIncoming || + final needToFilter = !displayOutgoing.value || + !displayIncoming.value || (startDate != null && endDate != null); if (needToFilter) { @@ -50,11 +79,11 @@ abstract class TransactionFilterStoreBase with Store { && (endDate?.isAfter(item.transaction.date) ?? false); } - if (allowed && (!displayOutgoing || !displayIncoming)) { - allowed = (displayOutgoing && + if (allowed && (!displayOutgoing.value || !displayIncoming.value)) { + allowed = (displayOutgoing.value && item.transaction.direction == TransactionDirection.outgoing) || - (displayIncoming && + (displayIncoming.value && item.transaction.direction == TransactionDirection.incoming); } diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart index 49dd2437a..d736769e2 100644 --- a/lib/view_model/dashboard/dashboard_view_model.dart +++ b/lib/view_model/dashboard/dashboard_view_model.dart @@ -60,13 +60,17 @@ abstract class DashboardViewModelBase with Store { filterItems = { S.current.transactions: [ FilterItem( - value: () => transactionFilterStore.displayIncoming, - caption: S.current.incoming, - onChanged: (value) => transactionFilterStore.toggleIncoming()), + value: transactionFilterStore.displayAll, + caption: 'S.current.all_transactions',//Fixme + onChanged: () => transactionFilterStore.toggleIAll()), FilterItem( - value: () => transactionFilterStore.displayOutgoing, + value: transactionFilterStore.displayIncoming, + caption: S.current.incoming, + 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, @@ -74,10 +78,20 @@ abstract class DashboardViewModelBase with Store { ], S.current.trades: [ FilterItem( - value: () => tradeFilterStore.displayChangeNow, + value: tradeFilterStore.displayAllTrades, + caption: 'S.current.all_trades',//Fixme + onChanged: () => tradeFilterStore + .toggleDisplayExchange(ExchangeProviderDescription.all)), + FilterItem( + value: tradeFilterStore.displayChangeNow, caption: 'Change.NOW', - onChanged: (value) => tradeFilterStore + onChanged: () => tradeFilterStore .toggleDisplayExchange(ExchangeProviderDescription.changeNow)), + FilterItem( + value: tradeFilterStore.displaySideShift, + caption: 'SideShift', + onChanged: () => tradeFilterStore + .toggleDisplayExchange(ExchangeProviderDescription.sideShift)), ] }, subname = '', diff --git a/lib/view_model/dashboard/filter_item.dart b/lib/view_model/dashboard/filter_item.dart index 0230899b4..8bc0f0bf1 100644 --- a/lib/view_model/dashboard/filter_item.dart +++ b/lib/view_model/dashboard/filter_item.dart @@ -1,10 +1,12 @@ +import 'package:mobx/mobx.dart'; + class FilterItem { FilterItem({ required this.value, required this.caption, required this.onChanged}); - bool Function() value; + Observable value; String caption; - Function(bool) onChanged; + Function onChanged; } \ No newline at end of file From 4269f18d013162b7fec61e5b0f37dc77fee00a86 Mon Sep 17 00:00:00 2001 From: Serhii Date: Thu, 10 Nov 2022 16:43:01 +0200 Subject: [PATCH 02/14] fix colors --- .../dashboard/widgets/filter_widget.dart | 18 +++--------------- lib/src/widgets/rounded_checkbox.dart | 10 +++++----- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/lib/src/screens/dashboard/widgets/filter_widget.dart b/lib/src/screens/dashboard/widgets/filter_widget.dart index 8719df562..10bda6798 100644 --- a/lib/src/screens/dashboard/widgets/filter_widget.dart +++ b/lib/src/screens/dashboard/widgets/filter_widget.dart @@ -28,16 +28,6 @@ class FilterWidget extends StatelessWidget { Column( mainAxisSize: MainAxisSize.min, children: [ - 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), child: ClipRRect( @@ -55,10 +45,8 @@ class FilterWidget extends StatelessWidget { child: Text( S.of(context).filters, style: TextStyle( - color: Theme.of(context) - .textTheme! - .bodyText1! - .decorationColor!, + color: Theme.of(context).primaryTextTheme + .overline!.color!, fontSize: 16, fontFamily: 'Lato', decoration: TextDecoration.none, @@ -182,7 +170,7 @@ class SectionDivider extends StatelessWidget { Widget build(BuildContext context) { return Container( height: 1, - color: Colors.red,//Fixme Theme.of(context).accentTextTheme.subhead.backgroundColor, + color: Theme.of(context).dividerColor, ); } } \ No newline at end of file diff --git a/lib/src/widgets/rounded_checkbox.dart b/lib/src/widgets/rounded_checkbox.dart index 6e5b08f1e..1bdfb267d 100644 --- a/lib/src/widgets/rounded_checkbox.dart +++ b/lib/src/widgets/rounded_checkbox.dart @@ -20,8 +20,8 @@ class RoundedCheckboxWidget extends StatelessWidget { Widget build(BuildContext context) { final baseGradient = LinearGradient(colors: [ - Colors.red, //Fixme Theme.of(context).primaryTextTheme!.subtitle!.color!, - Colors.red //Fixme Theme.of(context).primaryTextTheme!.subtitle!.decorationColor!, + Theme.of(context).primaryTextTheme.subtitle1!.color!, + Theme.of(context).primaryTextTheme.subtitle1!.decorationColor!, ], begin: Alignment.centerLeft, end: Alignment.centerRight); final darkThemeGradient = LinearGradient(colors: [ @@ -32,11 +32,11 @@ class RoundedCheckboxWidget extends StatelessWidget { final gradient = darkTheme ? darkThemeGradient : baseGradient; final uncheckedColor = darkTheme - ? Colors.red //Fixme Theme.of(context).accentTextTheme.subhead.decorationColor + ? Theme.of(context).primaryTextTheme.subtitle1!.decorationColor! : Colors.white; final borderColor = darkTheme - ? Colors.red //Fixme Theme.of(context).accentTextTheme.subtitle.backgroundColor + ? Theme.of(context).accentTextTheme.subtitle2!.backgroundColor! : Colors.transparent; final checkedOuterBoxDecoration = @@ -77,7 +77,7 @@ class RoundedCheckboxWidget extends StatelessWidget { child: Text( caption, style: TextStyle( - color: Colors.red, //Fixme Theme.of(context).primaryTextTheme.title.color, + color: Theme.of(context).primaryTextTheme.headline6!.color!, fontSize: 18, fontFamily: 'Lato', fontWeight: FontWeight.w500, From bf86fd6ed08890ef62a7b320d4d7b3595eb1ea68 Mon Sep 17 00:00:00 2001 From: Serhii Date: Thu, 10 Nov 2022 17:38:23 +0200 Subject: [PATCH 03/14] update localization --- lib/view_model/dashboard/dashboard_view_model.dart | 4 ++-- res/values/strings_de.arb | 6 ++++-- res/values/strings_en.arb | 6 ++++-- res/values/strings_es.arb | 6 ++++-- res/values/strings_fr.arb | 6 ++++-- res/values/strings_hi.arb | 6 ++++-- res/values/strings_hr.arb | 6 ++++-- res/values/strings_it.arb | 6 ++++-- res/values/strings_ja.arb | 6 ++++-- res/values/strings_ko.arb | 6 ++++-- res/values/strings_nl.arb | 6 ++++-- res/values/strings_pl.arb | 6 ++++-- res/values/strings_pt.arb | 6 ++++-- res/values/strings_ru.arb | 6 ++++-- res/values/strings_uk.arb | 6 ++++-- res/values/strings_zh.arb | 4 +++- 16 files changed, 61 insertions(+), 31 deletions(-) diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart index d736769e2..c1d57e241 100644 --- a/lib/view_model/dashboard/dashboard_view_model.dart +++ b/lib/view_model/dashboard/dashboard_view_model.dart @@ -61,7 +61,7 @@ abstract class DashboardViewModelBase with Store { S.current.transactions: [ FilterItem( value: transactionFilterStore.displayAll, - caption: 'S.current.all_transactions',//Fixme + caption: S.current.all_transactions, onChanged: () => transactionFilterStore.toggleIAll()), FilterItem( value: transactionFilterStore.displayIncoming, @@ -79,7 +79,7 @@ abstract class DashboardViewModelBase with Store { S.current.trades: [ FilterItem( value: tradeFilterStore.displayAllTrades, - caption: 'S.current.all_trades',//Fixme + caption: S.current.all_trades, onChanged: () => tradeFilterStore .toggleDisplayExchange(ExchangeProviderDescription.all)), FilterItem( diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index 685d817d5..36f3b5172 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -48,7 +48,7 @@ "outgoing" : "Ausgehend", "transactions_by_date" : "Transaktionen nach Datum", "trades" : "Börsen", - "filters" : "Filter", + "filters" : "Filtern nach", "today" : "Heute", "yesterday" : "Gestern", "received" : "Empfangen", @@ -651,5 +651,7 @@ "ignor": "Ignorieren", "use_suggested": "Vorgeschlagen verwenden", "do_not_share_warning_text" : "Teilen Sie diese nicht mit anderen, einschließlich des Supports.\n\nSie werden Ihr Geld stehlen!", - "help": "hilfe" + "help": "hilfe", + "all_transactions": "Alle Transaktionen", + "all_trades": "Alle Gewerke" } diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index 877d09231..694de99c3 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -48,7 +48,7 @@ "outgoing" : "Outgoing", "transactions_by_date" : "Transactions by date", "trades" : "Trades", - "filters" : "Filter", + "filters" : "Filter by", "today" : "Today", "yesterday" : "Yesterday", "received" : "Received", @@ -651,5 +651,7 @@ "ignor": "Ignore", "use_suggested": "Use Suggested", "do_not_share_warning_text" : "Do not share these with anyone else, including support.\n\nThey will steal your money!", - "help": "help" + "help": "help", + "all_transactions": "All transactions", + "all_trades": "All trades" } diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index 505f3ffa8..b3af2a5c7 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -48,7 +48,7 @@ "outgoing" : "Saliente", "transactions_by_date" : "Transacciones por fecha", "trades" : "Cambios", - "filters" : "Filtrar", + "filters" : "Filtrado por", "today" : "Hoy", "yesterday" : "Ayer", "received" : "Recibido", @@ -651,5 +651,7 @@ "ignor": "Pasar por alto", "use_suggested": "Usar sugerido", "do_not_share_warning_text" : "No comparta estos con nadie más, incluido el soporte.\n\n¡Te robarán tu dinero!", - "help": "ayuda" + "help": "ayuda", + "all_transactions": "Todas las transacciones", + "all_trades": "Todos los oficios" } diff --git a/res/values/strings_fr.arb b/res/values/strings_fr.arb index 941016c0b..aa50a4859 100644 --- a/res/values/strings_fr.arb +++ b/res/values/strings_fr.arb @@ -46,7 +46,7 @@ "outgoing" : "Sortantes", "transactions_by_date" : "Transactions par date", "trades" : "Échanges", - "filters" : "Filtre", + "filters" : "Filtrer par", "today" : "Aujourd'hui", "yesterday" : "Hier", "received" : "Reçus", @@ -649,5 +649,7 @@ "ignor": "Ignorer", "use_suggested": "Utilisation suggérée", "do_not_share_warning_text" : "Ne les partagez avec personne d'autre, y compris avec l'assistance.\n\nIls vont voler votre argent!", - "help": "aider" + "help": "aider", + "all_transactions": "Toutes transactions", + "all_trades": "Tous métiers" } diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index 7faa06f7f..f64e1c42c 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -48,7 +48,7 @@ "outgoing" : "निवर्तमान", "transactions_by_date" : "तारीख से लेन-देन", "trades" : "ट्रेडों", - "filters" : "फ़िल्टर", + "filters" : "के द्वारा छनित", "today" : "आज", "yesterday" : "बिता कल", "received" : "प्राप्त किया", @@ -651,5 +651,7 @@ "ignor": "नज़रअंदाज़ करना", "use_suggested": "सुझाए गए का प्रयोग करें", "do_not_share_warning_text" : "इन्हें समर्थन सहित किसी और के साथ साझा न करें।\n\nवे आपका पैसा चुरा लेंगे!", - "help": "मदद करना" + "help": "मदद करना", + "all_transactions": "सभी लेन - देन", + "all_trades": "सभी व्यापार" } diff --git a/res/values/strings_hr.arb b/res/values/strings_hr.arb index 4fa77948a..94668ff47 100644 --- a/res/values/strings_hr.arb +++ b/res/values/strings_hr.arb @@ -48,7 +48,7 @@ "outgoing" : "Odlazno", "transactions_by_date" : "Transakcije prema datumu", "trades" : "Razmjene", - "filters" : "Filter", + "filters" : "Filtrirati po", "today" : "Danas", "yesterday" : "Jučer", "received" : "Primljeno", @@ -651,5 +651,7 @@ "ignor": "Zanemariti", "use_suggested": "Koristite predloženo", "do_not_share_warning_text" : "Nemojte ih dijeliti ni s kim, uključujući podršku.\n\nUkrast će vam novac!", - "help": "pomozite" + "help": "pomozite", + "all_transactions": "Sve transakcije", + "all_trades": "Svi obrti" } diff --git a/res/values/strings_it.arb b/res/values/strings_it.arb index 9a42a588b..c8016f481 100644 --- a/res/values/strings_it.arb +++ b/res/values/strings_it.arb @@ -48,7 +48,7 @@ "outgoing" : "In uscita", "transactions_by_date" : "Transazioni per data", "trades" : "Scambi", - "filters" : "Filtri", + "filters" : "Filtrirati po", "today" : "Oggi", "yesterday" : "Ieri", "received" : "Ricevuto", @@ -651,5 +651,7 @@ "ignor": "Ignorare", "use_suggested": "Usa suggerito", "do_not_share_warning_text" : "Non condividerli con nessun altro, incluso il supporto.\n\nTi ruberanno i soldi!", - "help": "aiuto" + "help": "aiuto", + "all_transactions": "Sve transakcije", + "all_trades": "Svi obrti" } diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index c1d0de4e3..220e4f5df 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -48,7 +48,7 @@ "outgoing" : "発信", "transactions_by_date" : "日付ごとの取引", "trades" : "取引", - "filters" : "フィルタ", + "filters" : "でフィルタリング", "today" : "今日", "yesterday" : "昨日", "received" : "受け取った", @@ -651,5 +651,7 @@ "ignor": "無視", "use_suggested": "推奨を使用", "do_not_share_warning_text" : "サポートを含め、これらを他の誰とも共有しないでください。\n\n彼らはあなたのお金を盗みます!", - "help": "ヘルプ" + "help": "ヘルプ", + "all_transactions": "全取引", + "all_trades": "すべての取引" } diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index 127aa949e..1bef56dbc 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -48,7 +48,7 @@ "outgoing" : "나가는", "transactions_by_date" : "날짜 별 거래", "trades" : "거래", - "filters" : "필터", + "filters" : "필터링 기준", "today" : "오늘", "yesterday" : "어제", "received" : "받았습니다", @@ -651,5 +651,7 @@ "ignor": "무시하다", "use_suggested": "추천 사용", "do_not_share_warning_text" : "지원을 포함하여 다른 사람과 이러한 정보를 공유하지 마십시오.\n\n그들은 당신의 돈을 훔칠 것입니다!", - "help": "돕다" + "help": "돕다", + "all_transactions": "모든 거래 창구", + "all_trades": "A모든 거래" } diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index fa748b552..3db8ad2f7 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -48,7 +48,7 @@ "outgoing" : "Uitgaande", "transactions_by_date" : "Transacties op datum", "trades" : "Trades", - "filters" : "Filter", + "filters" : "Filteren op", "today" : "Vandaag", "yesterday" : "Gisteren", "received" : "Ontvangen", @@ -651,5 +651,7 @@ "ignor": "Negeren", "use_suggested": "Gebruik aanbevolen", "do_not_share_warning_text" : "Deel deze met niemand anders, ook niet met support.\n\nZe zullen je geld stelen!", - "help": "helpen" + "help": "helpen", + "all_transactions": "Alle transacties", + "all_trades": "Alle transacties" } diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index 454fe9717..83ec99d99 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -48,7 +48,7 @@ "outgoing" : "Towarzyski", "transactions_by_date" : "Transakcje według daty", "trades" : "Transakcje", - "filters" : "Filtr", + "filters" : "Filtruj według", "today" : "Dzisiaj", "yesterday" : "Wczoraj", "received" : "Odebrane", @@ -651,5 +651,7 @@ "ignor": "Ignorować", "use_suggested": "Użyj sugerowane", "do_not_share_warning_text" : "Nie udostępniaj ich nikomu innemu, w tym wsparcia.\n\nUkradną twoje pieniądze!", - "help": "pomoc" + "help": "pomoc", + "all_transactions": "Wszystkie transakcje", + "all_trades": "Wszystkie operacje" } diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index 04a0a3ff2..866dcd26c 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -48,7 +48,7 @@ "outgoing" : "Enviadas", "transactions_by_date" : "Transações por data", "trades" : "Trocas", - "filters" : "Filtro", + "filters" : "Filtrar por", "today" : "Hoje", "yesterday" : "Ontem", "received" : "Recebida", @@ -651,5 +651,7 @@ "ignor": "Ignorar", "use_suggested": "Uso sugerido", "do_not_share_warning_text" : "Não os compartilhe com mais ninguém, incluindo suporte.\n\nEles vão roubar seu dinheiro!", - "help": "ajuda" + "help": "ajuda", + "all_transactions": "Todas as transacções", + "all_trades": "Todas as negociações" } diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index 632b0990c..b34d4df15 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -48,7 +48,7 @@ "outgoing" : "Исходящие", "transactions_by_date" : "Сортировать по дате", "trades" : "Сделки", - "filters" : "Фильтр", + "filters" : "Фильтровать по", "today" : "Сегодня", "yesterday" : "Вчера", "received" : "Полученные", @@ -651,5 +651,7 @@ "ignor": "Игнорировать", "use_suggested": "Использовать предложенный", "do_not_share_warning_text" : "Не делитесь ими с кем-либо еще, в том числе со службой поддержки.\n\nОни украдут ваши деньги!", - "help": "помощь" + "help": "помощь", + "all_transactions": "Все транзакции", + "all_trades": "Все сделки" } diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index 5e0f0d18a..285a67fa5 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -48,7 +48,7 @@ "outgoing" : "Вихідні", "transactions_by_date" : "Сортувати по даті", "trades" : "Торгові операції", - "filters" : "Фільтр", + "filters" : "Фільтрувати по", "today" : "Сьогодні", "yesterday" : "Вчора", "received" : "Отримані", @@ -650,5 +650,7 @@ "ignor": "Ігнорувати", "use_suggested": "Використати запропоноване", "do_not_share_warning_text" : "Не повідомляйте їх нікому, включно зі службою підтримки.\n\nВони вкрадуть ваші гроші!", - "help": "допомога" + "help": "допомога", + "all_transactions": "Всі транзакції", + "all_trades": "Всі операції" } diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index c46d07d59..8212d83b6 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -649,5 +649,7 @@ "ignor": "忽视", "use_suggested": "使用建议", "do_not_share_warning_text" : "不要與其他任何人分享這些內容,包括支持。\n\n他們會偷你的錢!", - "help": "帮助" + "help": "帮助", + "all_transactions": "所有交易", + "all_trades": "所有的变化" } From ff28dfbb9ca071e57035089b016b48bea07d24ea Mon Sep 17 00:00:00 2001 From: Serhii Date: Sat, 10 Dec 2022 11:40:04 +0200 Subject: [PATCH 04/14] Rename Change.NOW --- lib/view_model/dashboard/dashboard_view_model.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart index 284b1fc72..40ea2d78b 100644 --- a/lib/view_model/dashboard/dashboard_view_model.dart +++ b/lib/view_model/dashboard/dashboard_view_model.dart @@ -83,12 +83,12 @@ abstract class DashboardViewModelBase with Store { .toggleDisplayExchange(ExchangeProviderDescription.all)), FilterItem( value: tradeFilterStore.displayChangeNow, - caption: 'Change.NOW', + caption: ExchangeProviderDescription.changeNow.title, onChanged: () => tradeFilterStore .toggleDisplayExchange(ExchangeProviderDescription.changeNow)), FilterItem( value: tradeFilterStore.displaySideShift, - caption: 'SideShift', + caption: ExchangeProviderDescription.sideShift.title, onChanged: () => tradeFilterStore .toggleDisplayExchange(ExchangeProviderDescription.sideShift)), ] From c57507e530d3bff5792f4272842a6a6cf0e20721 Mon Sep 17 00:00:00 2001 From: Serhii Date: Sat, 10 Dec 2022 12:56:37 +0200 Subject: [PATCH 05/14] redesigh checkbox --- .../dashboard/widgets/filter_widget.dart | 13 ++- lib/src/widgets/rounded_checkbox.dart | 91 ------------------- lib/src/widgets/standard_checkbox.dart | 44 ++++++--- 3 files changed, 39 insertions(+), 109 deletions(-) delete mode 100644 lib/src/widgets/rounded_checkbox.dart diff --git a/lib/src/screens/dashboard/widgets/filter_widget.dart b/lib/src/screens/dashboard/widgets/filter_widget.dart index 10bda6798..a3172940f 100644 --- a/lib/src/screens/dashboard/widgets/filter_widget.dart +++ b/lib/src/screens/dashboard/widgets/filter_widget.dart @@ -1,12 +1,12 @@ 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/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/rounded_checkbox.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; @@ -97,14 +97,13 @@ class FilterWidget extends StatelessWidget { final content = item.onChanged != null ? Observer( builder: (_) => - RoundedCheckboxWidget( + StandardCheckbox( value: item.value.value, caption: item.caption, - onChanged: item.onChanged, - currentTheme: - dashboardViewModel - .settingsStore - .currentTheme, + gradientBackground: true, + borderColor: Theme.of(context).dividerColor, + iconColor: Colors.white, + onChanged: (bool val){}, )) : GestureDetector( onTap: () async { diff --git a/lib/src/widgets/rounded_checkbox.dart b/lib/src/widgets/rounded_checkbox.dart deleted file mode 100644 index 1bdfb267d..000000000 --- a/lib/src/widgets/rounded_checkbox.dart +++ /dev/null @@ -1,91 +0,0 @@ -import 'package:cake_wallet/palette.dart'; -import 'package:flutter/material.dart'; -import 'package:cake_wallet/themes/theme_base.dart'; - -class RoundedCheckboxWidget extends StatelessWidget { - RoundedCheckboxWidget( - {required this.value, - required this.caption, - required this.onChanged, - this.currentTheme}); - - final bool value; - final String caption; - final Function onChanged; - final ThemeBase? currentTheme; - - bool get darkTheme => currentTheme!.type == ThemeType.dark; - - @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 darkThemeGradient = LinearGradient(colors: [ - Palette.blueCraiola, - Palette.blueGreyCraiola, - ], begin: Alignment.topLeft, end: Alignment.bottomRight); - - final gradient = darkTheme ? darkThemeGradient : baseGradient; - - final uncheckedColor = darkTheme - ? Theme.of(context).primaryTextTheme.subtitle1!.decorationColor! - : Colors.white; - - final borderColor = darkTheme - ? Theme.of(context).accentTextTheme.subtitle2!.backgroundColor! - : Colors.transparent; - - final checkedOuterBoxDecoration = - BoxDecoration(shape: BoxShape.circle, gradient: gradient); - final outerBoxDecoration = BoxDecoration( - shape: BoxShape.circle, - color: Theme.of(context).accentTextTheme.overline!.color!, - border: Border.all(color: borderColor)); - - final checkedInnerBoxDecoration = - BoxDecoration(shape: BoxShape.circle, color: Colors.white); - final innerBoxDecoration = - BoxDecoration(shape: BoxShape.circle, color: uncheckedColor); - - return GestureDetector( - onTap: () => onChanged(), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - height: 24.0, - width: 24.0, - child: DecoratedBox( - decoration: - value ? checkedOuterBoxDecoration : outerBoxDecoration, - child: Padding( - padding: EdgeInsets.all(value ? 4.0 : 1.0), - child: DecoratedBox( - decoration: - value ? checkedInnerBoxDecoration : innerBoxDecoration, - ), - ), - ), - ), - Padding( - padding: EdgeInsets.only(left: 16), - child: Text( - caption, - style: TextStyle( - color: Theme.of(context).primaryTextTheme.headline6!.color!, - fontSize: 18, - fontFamily: 'Lato', - fontWeight: FontWeight.w500, - decoration: TextDecoration.none), - ), - ) - ], - ), - ); - } -} \ No newline at end of file diff --git a/lib/src/widgets/standard_checkbox.dart b/lib/src/widgets/standard_checkbox.dart index a59364fe1..9202ea7f5 100644 --- a/lib/src/widgets/standard_checkbox.dart +++ b/lib/src/widgets/standard_checkbox.dart @@ -7,11 +7,17 @@ class StandardCheckbox extends StatefulWidget { Key? key, required this.value, this.caption = '', + this.gradientBackground = false, + this.borderColor, + this.iconColor, required this.onChanged}) : super(key: key); final bool value; final String caption; + final bool gradientBackground; + final Color? borderColor; + final Color? iconColor; final Function(bool) onChanged; @override @@ -32,6 +38,31 @@ class StandardCheckboxState extends State { @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: widget.borderColor ?? Theme.of(context) + .primaryTextTheme + .caption! + .color!, + width: 1.0); + + + final checkedBoxDecoration = BoxDecoration( + gradient: widget.gradientBackground ? baseGradient : null, + border: widget.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; @@ -45,20 +76,11 @@ class StandardCheckboxState extends State { 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, + color: widget.iconColor ?? Colors.blue, size: 20.0, ) : Offstage(), From b536973077b27058126af54f930d1c3cf93f5013 Mon Sep 17 00:00:00 2001 From: Serhii Date: Mon, 12 Dec 2022 00:07:05 +0200 Subject: [PATCH 06/14] make checkbox stateless --- .../dashboard/widgets/filter_widget.dart | 2 +- lib/src/screens/exchange/exchange_page.dart | 8 ----- lib/src/widgets/standard_checkbox.dart | 34 ++++--------------- .../dashboard/dashboard_view_model.dart | 6 ++-- 4 files changed, 11 insertions(+), 39 deletions(-) diff --git a/lib/src/screens/dashboard/widgets/filter_widget.dart b/lib/src/screens/dashboard/widgets/filter_widget.dart index a3172940f..411006633 100644 --- a/lib/src/screens/dashboard/widgets/filter_widget.dart +++ b/lib/src/screens/dashboard/widgets/filter_widget.dart @@ -103,7 +103,7 @@ class FilterWidget extends StatelessWidget { gradientBackground: true, borderColor: Theme.of(context).dividerColor, iconColor: Colors.white, - onChanged: (bool val){}, + onChanged: (value) => item.onChanged(), )) : GestureDetector( onTap: () async { diff --git a/lib/src/screens/exchange/exchange_page.dart b/lib/src/screens/exchange/exchange_page.dart index 744848156..7b73a134b 100644 --- a/lib/src/screens/exchange/exchange_page.dart +++ b/lib/src/screens/exchange/exchange_page.dart @@ -40,7 +40,6 @@ class ExchangePage extends BasePage { final ExchangeViewModel exchangeViewModel; final depositKey = GlobalKey(); final receiveKey = GlobalKey(); - final checkBoxKey = GlobalKey(); final _formKey = GlobalKey(); 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); diff --git a/lib/src/widgets/standard_checkbox.dart b/lib/src/widgets/standard_checkbox.dart index 9202ea7f5..d7b947a7e 100644 --- a/lib/src/widgets/standard_checkbox.dart +++ b/lib/src/widgets/standard_checkbox.dart @@ -2,16 +2,14 @@ import 'dart:ui'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class StandardCheckbox extends StatefulWidget { +class StandardCheckbox extends StatelessWidget { StandardCheckbox({ - Key? key, required this.value, this.caption = '', this.gradientBackground = false, this.borderColor, this.iconColor, - required this.onChanged}) - : super(key: key); + required this.onChanged}); final bool value; final String caption; @@ -20,21 +18,7 @@ class StandardCheckbox extends StatefulWidget { final Color? iconColor; final Function(bool) onChanged; - @override - StandardCheckboxState createState() => - StandardCheckboxState(value, caption, onChanged); -} -class StandardCheckboxState extends State { - 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) { @@ -45,7 +29,7 @@ class StandardCheckboxState extends State { ], begin: Alignment.centerLeft, end: Alignment.centerRight); final boxBorder = Border.all( - color: widget.borderColor ?? Theme.of(context) + color: borderColor ?? Theme.of(context) .primaryTextTheme .caption! .color!, @@ -53,8 +37,8 @@ class StandardCheckboxState extends State { final checkedBoxDecoration = BoxDecoration( - gradient: widget.gradientBackground ? baseGradient : null, - border: widget.gradientBackground ? null : boxBorder, + gradient: gradientBackground ? baseGradient : null, + border: gradientBackground ? null : boxBorder, borderRadius: BorderRadius.all( Radius.circular(8.0))); @@ -64,11 +48,7 @@ class StandardCheckboxState extends State { Radius.circular(8.0))); return GestureDetector( - onTap: () { - value = !value; - onChanged(value); - setState(() {}); - }, + onTap: () => onChanged(!value), child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, @@ -80,7 +60,7 @@ class StandardCheckboxState extends State { child: value ? Icon( Icons.check, - color: widget.iconColor ?? Colors.blue, + color: iconColor ?? Colors.blue, size: 20.0, ) : Offstage(), diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart index 40ea2d78b..ac38a43cc 100644 --- a/lib/view_model/dashboard/dashboard_view_model.dart +++ b/lib/view_model/dashboard/dashboard_view_model.dart @@ -61,15 +61,15 @@ abstract class DashboardViewModelBase with Store { FilterItem( value: transactionFilterStore.displayAll, caption: S.current.all_transactions, - onChanged: () => transactionFilterStore.toggleIAll()), + onChanged: transactionFilterStore.toggleIAll), FilterItem( value: transactionFilterStore.displayIncoming, caption: S.current.incoming, - onChanged: () => transactionFilterStore.toggleIncoming()), + onChanged:transactionFilterStore.toggleIncoming), FilterItem( value: transactionFilterStore.displayOutgoing, caption: S.current.outgoing, - onChanged: () => transactionFilterStore.toggleOutgoing()), + onChanged: transactionFilterStore.toggleOutgoing), // FilterItem( // value: () => false, // caption: S.current.transactions_by_date, From 7d08bb0e76265dd28c15d5877a20724895532093 Mon Sep 17 00:00:00 2001 From: Serhii Date: Mon, 12 Dec 2022 00:37:03 +0200 Subject: [PATCH 07/14] Add SimpleSwap --- lib/view_model/dashboard/dashboard_view_model.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart index ac38a43cc..ba0f9f8ff 100644 --- a/lib/view_model/dashboard/dashboard_view_model.dart +++ b/lib/view_model/dashboard/dashboard_view_model.dart @@ -91,6 +91,11 @@ abstract class DashboardViewModelBase with Store { caption: ExchangeProviderDescription.sideShift.title, onChanged: () => tradeFilterStore .toggleDisplayExchange(ExchangeProviderDescription.sideShift)), + FilterItem( + value: tradeFilterStore.displaySimpleSwap, + caption: ExchangeProviderDescription.simpleSwap.title, + onChanged: () => tradeFilterStore + .toggleDisplayExchange(ExchangeProviderDescription.simpleSwap)), ] }, subname = '', From b1120cf2f83a49a75b4d8ac9e8eb0a467ef3b94f Mon Sep 17 00:00:00 2001 From: Serhii Date: Mon, 12 Dec 2022 14:01:37 +0200 Subject: [PATCH 08/14] fix filter for SideShift --- lib/store/dashboard/trade_filter_store.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/store/dashboard/trade_filter_store.dart b/lib/store/dashboard/trade_filter_store.dart index 4319c3bc7..9c1dc9a9a 100644 --- a/lib/store/dashboard/trade_filter_store.dart +++ b/lib/store/dashboard/trade_filter_store.dart @@ -79,6 +79,8 @@ abstract class TradeFilterStoreBase with Store { .where((item) => (displayXMRTO.value && item.trade.provider == ExchangeProviderDescription.xmrto) || + (displaySideShift.value && + item.trade.provider == ExchangeProviderDescription.sideShift) || (displayChangeNow.value && item.trade.provider == ExchangeProviderDescription.changeNow) || From 2da50776d16629d044211ced3a80456ca9f18c14 Mon Sep 17 00:00:00 2001 From: Serhii Date: Mon, 12 Dec 2022 14:28:53 +0200 Subject: [PATCH 09/14] code formatting --- .../dashboard/widgets/filter_widget.dart | 198 ++++++++---------- .../exchange_trade/exchange_trade_page.dart | 4 +- .../order_details/order_details_page.dart | 6 +- .../widgets/settings_switcher_cell.dart | 4 +- .../trade_details/trade_details_page.dart | 14 +- .../transaction_details_page.dart | 6 +- .../unspent_coins_details_page.dart | 4 +- .../widgets/unspent_coins_switch_row.dart | 4 +- .../screens/wallet_keys/wallet_keys_page.dart | 4 +- lib/src/widgets/standard_checkbox.dart | 67 +++--- lib/src/widgets/standard_list.dart | 6 +- ...list_card.dart => standard_list_card.dart} | 4 +- ...t_list_row.dart => standard_list_row.dart} | 4 +- ...row.dart => standard_list_status_row.dart} | 4 +- ...ndart_switch.dart => standard_switch.dart} | 8 +- 15 files changed, 151 insertions(+), 186 deletions(-) rename lib/src/widgets/{standart_list_card.dart => standard_list_card.dart} (96%) rename lib/src/widgets/{standart_list_row.dart => standard_list_row.dart} (96%) rename lib/src/widgets/{standart_list_status_row.dart => standard_list_status_row.dart} (95%) rename lib/src/widgets/{standart_switch.dart => standard_switch.dart} (81%) diff --git a/lib/src/screens/dashboard/widgets/filter_widget.dart b/lib/src/screens/dashboard/widgets/filter_widget.dart index 411006633..6831819e4 100644 --- a/lib/src/screens/dashboard/widgets/filter_widget.dart +++ b/lib/src/screens/dashboard/widgets/filter_widget.dart @@ -15,8 +15,7 @@ class FilterWidget extends StatelessWidget { FilterWidget({required this.dashboardViewModel}); final DashboardViewModel dashboardViewModel; - final closeIcon = - Image.asset('assets/images/close.png', color: Palette.darkBlueCraiola); + final closeIcon = Image.asset('assets/images/close.png', color: Palette.darkBlueCraiola); @override Widget build(BuildContext context) { @@ -33,71 +32,55 @@ class FilterWidget extends StatelessWidget { child: ClipRRect( borderRadius: BorderRadius.all(Radius.circular(24)), child: Container( - color: Theme.of(context) - .textTheme! - .bodyText1! - .decorationColor!, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.all(24.0), - child: Text( - S.of(context).filters, - style: TextStyle( - color: Theme.of(context).primaryTextTheme - .overline!.color!, - fontSize: 16, - fontFamily: 'Lato', - decoration: TextDecoration.none, - ), - ), + color: Theme.of(context).textTheme!.bodyText1!.decorationColor!, + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Padding( + padding: EdgeInsets.all(24.0), + child: Text( + S.of(context).filters, + style: TextStyle( + color: Theme.of(context).primaryTextTheme.overline!.color!, + fontSize: 16, + 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: [ - 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.builder( - padding: - EdgeInsets.symmetric(vertical: 8.0), - shrinkWrap: true, - physics: - const NeverScrollableScrollPhysics(), - itemCount: section.length, - itemBuilder: (_, index2) { - final item = section[index2]; - final content = item.onChanged != null - ? Observer( - builder: (_) => - StandardCheckbox( + ), + ), + 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: [ + 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.builder( + padding: EdgeInsets.symmetric(vertical: 8.0), + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemCount: section.length, + itemBuilder: (_, index2) { + final item = section[index2]; + final content = item.onChanged != null + ? Observer( + builder: (_) => StandardCheckbox( value: item.value.value, caption: item.caption, gradientBackground: true, @@ -105,51 +88,48 @@ class FilterWidget extends StatelessWidget { iconColor: Colors.white, onChanged: (value) => item.onChanged(), )) - : GestureDetector( - onTap: () async { - //final List 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))); + : GestureDetector( + onTap: () async { + //final List 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: Colors.red, - //Theme.of(context).primaryTextTheme.title.color,// - fontSize: 18, - fontFamily: 'Lato', - fontWeight: - FontWeight.w500, - decoration: - TextDecoration.none), + //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: Colors.red, + //Theme.of(context).primaryTextTheme.title.color,// + fontSize: 18, + fontFamily: 'Lato', + fontWeight: FontWeight.w500, + decoration: TextDecoration.none), + ), ), - ), - ); + ); - return FilterTile(child: content); - }, - ) - ], - ); - }, - ), - ]), + return FilterTile(child: content); + }, + ) + ], + ); + }, + ), + ]), ), ), ), @@ -172,4 +152,4 @@ class SectionDivider extends StatelessWidget { color: Theme.of(context).dividerColor, ); } -} \ No newline at end of file +} diff --git a/lib/src/screens/exchange_trade/exchange_trade_page.dart b/lib/src/screens/exchange_trade/exchange_trade_page.dart index 7c9fc1be7..e3eb8db96 100644 --- a/lib/src/screens/exchange_trade/exchange_trade_page.dart +++ b/lib/src/screens/exchange_trade/exchange_trade_page.dart @@ -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/standard_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 { final item = widget.exchangeTradeViewModel.items[index]; final value = item.data ?? fetchingLabel; - final content = StandartListRow( + final content = AnotherStandardListRow( title: item.title, value: value, valueFontSize: 14, diff --git a/lib/src/screens/order_details/order_details_page.dart b/lib/src/screens/order_details/order_details_page.dart index 2e6ece509..a7eff99b8 100644 --- a/lib/src/screens/order_details/order_details_page.dart +++ b/lib/src/screens/order_details/order_details_page.dart @@ -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/standard_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 { if (item is TrackTradeListItem) { return GestureDetector( onTap: item.onTap, - child: StandartListRow( + child: AnotherStandardListRow( title: '${item.title}', value: '${item.value}')); } else { return GestureDetector( @@ -65,7 +65,7 @@ class OrderDetailsPageBodyState extends State { Clipboard.setData(ClipboardData(text: '${item.value}')); showBar(context, S.of(context).copied_to_clipboard); }, - child: StandartListRow( + child: AnotherStandardListRow( title: '${item.title}', value: '${item.value}')); } }); diff --git a/lib/src/screens/settings/widgets/settings_switcher_cell.dart b/lib/src/screens/settings/widgets/settings_switcher_cell.dart index fc99f3297..c1d7fa150 100644 --- a/lib/src/screens/settings/widgets/settings_switcher_cell.dart +++ b/lib/src/screens/settings/widgets/settings_switcher_cell.dart @@ -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)); } diff --git a/lib/src/screens/trade_details/trade_details_page.dart b/lib/src/screens/trade_details/trade_details_page.dart index 500d16beb..1bb5d3ec8 100644 --- a/lib/src/screens/trade_details/trade_details_page.dart +++ b/lib/src/screens/trade_details/trade_details_page.dart @@ -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/standard_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 { if (item is TrackTradeListItem) { return GestureDetector( onTap: item.onTap, - child: StandartListRow( + child: AnotherStandardListRow( 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 { Clipboard.setData(ClipboardData(text: '${item.value}')); showBar(context, S.of(context).copied_to_clipboard); }, - child: StandartListRow( + child: AnotherStandardListRow( title: '${item.title}', value: '${item.value}')); }); }); diff --git a/lib/src/screens/transaction_details/transaction_details_page.dart b/lib/src/screens/transaction_details/transaction_details_page.dart index 098d65c23..8d3ae8c9e 100644 --- a/lib/src/screens/transaction_details/transaction_details_page.dart +++ b/lib/src/screens/transaction_details/transaction_details_page.dart @@ -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/standard_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), + AnotherStandardListRow(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), + AnotherStandardListRow(title: '${item.title}:', value: item.value), ); } diff --git a/lib/src/screens/unspent_coins/unspent_coins_details_page.dart b/lib/src/screens/unspent_coins/unspent_coins_details_page.dart index b1c4ff01b..74fbcfdd9 100644 --- a/lib/src/screens/unspent_coins/unspent_coins_details_page.dart +++ b/lib/src/screens/unspent_coins/unspent_coins_details_page.dart @@ -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/standard_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 AnotherStandardListRow( title: '${item.title}:', value: item.value); } diff --git a/lib/src/screens/unspent_coins/widgets/unspent_coins_switch_row.dart b/lib/src/screens/unspent_coins/widgets/unspent_coins_switch_row.dart index 6272469df..734aeb7ee 100644 --- a/lib/src/screens/unspent_coins/widgets/unspent_coins_switch_row.dart +++ b/lib/src/screens/unspent_coins/widgets/unspent_coins_switch_row.dart @@ -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)) ) diff --git a/lib/src/screens/wallet_keys/wallet_keys_page.dart b/lib/src/screens/wallet_keys/wallet_keys_page.dart index 942809ac8..f97200e1e 100644 --- a/lib/src/screens/wallet_keys/wallet_keys_page.dart +++ b/lib/src/screens/wallet_keys/wallet_keys_page.dart @@ -6,7 +6,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/standard_list_row.dart'; import 'package:cake_wallet/view_model/wallet_keys_view_model.dart'; class WalletKeysPage extends BasePage { @@ -71,7 +71,7 @@ class WalletKeysPage extends BasePage { Clipboard.setData(ClipboardData(text: item.value)); showBar(context, S.of(context).copied_key_to_clipboard(item.title)); }, - child: StandartListRow( + child: AnotherStandardListRow( title: item.title + ':', value: item.value, ), diff --git a/lib/src/widgets/standard_checkbox.dart b/lib/src/widgets/standard_checkbox.dart index d7b947a7e..d2cd6463d 100644 --- a/lib/src/widgets/standard_checkbox.dart +++ b/lib/src/widgets/standard_checkbox.dart @@ -3,13 +3,13 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class StandardCheckbox extends StatelessWidget { - StandardCheckbox({ - required this.value, - this.caption = '', - this.gradientBackground = false, - this.borderColor, - this.iconColor, - required this.onChanged}); + StandardCheckbox( + {required this.value, + this.caption = '', + this.gradientBackground = false, + this.borderColor, + this.iconColor, + required this.onChanged}); final bool value; final String caption; @@ -18,34 +18,23 @@ class StandardCheckbox extends StatelessWidget { final Color? iconColor; final Function(bool) onChanged; - - @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); - + 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))); + borderRadius: BorderRadius.all(Radius.circular(8.0))); - final uncheckedBoxDecoration = BoxDecoration( - border: boxBorder, - borderRadius: BorderRadius.all( - Radius.circular(8.0))); + final uncheckedBoxDecoration = + BoxDecoration(border: boxBorder, borderRadius: BorderRadius.all(Radius.circular(8.0))); return GestureDetector( onTap: () => onChanged(!value), @@ -58,27 +47,23 @@ class StandardCheckbox extends StatelessWidget { width: 24.0, decoration: value ? checkedBoxDecoration : uncheckedBoxDecoration, child: value - ? Icon( - Icons.check, - color: iconColor ?? 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!), + )) ], ), ); } -} \ No newline at end of file +} diff --git a/lib/src/widgets/standard_list.dart b/lib/src/widgets/standard_list.dart index f5abdd900..680cf6edd 100644 --- a/lib/src/widgets/standard_list.dart +++ b/lib/src/widgets/standard_list.dart @@ -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(); } diff --git a/lib/src/widgets/standart_list_card.dart b/lib/src/widgets/standard_list_card.dart similarity index 96% rename from lib/src/widgets/standart_list_card.dart rename to lib/src/widgets/standard_list_card.dart index 569a4e51f..7b2ecc2ce 100644 --- a/lib/src/widgets/standart_list_card.dart +++ b/lib/src/widgets/standard_list_card.dart @@ -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, diff --git a/lib/src/widgets/standart_list_row.dart b/lib/src/widgets/standard_list_row.dart similarity index 96% rename from lib/src/widgets/standart_list_row.dart rename to lib/src/widgets/standard_list_row.dart index 94a4c4c76..e174acc50 100644 --- a/lib/src/widgets/standart_list_row.dart +++ b/lib/src/widgets/standard_list_row.dart @@ -1,8 +1,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class StandartListRow extends StatelessWidget { - StandartListRow( +class AnotherStandardListRow extends StatelessWidget { + AnotherStandardListRow( {required this.title, required this.value, this.titleFontSize = 14, diff --git a/lib/src/widgets/standart_list_status_row.dart b/lib/src/widgets/standard_list_status_row.dart similarity index 95% rename from lib/src/widgets/standart_list_status_row.dart rename to lib/src/widgets/standard_list_status_row.dart index d97c4f688..f958e83ae 100644 --- a/lib/src/widgets/standart_list_status_row.dart +++ b/lib/src/widgets/standard_list_status_row.dart @@ -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; diff --git a/lib/src/widgets/standart_switch.dart b/lib/src/widgets/standard_switch.dart similarity index 81% rename from lib/src/widgets/standart_switch.dart rename to lib/src/widgets/standard_switch.dart index 3018fb5b4..929286058 100644 --- a/lib/src/widgets/standart_switch.dart +++ b/lib/src/widgets/standard_switch.dart @@ -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 { +class StandardSwitchState extends State { @override Widget build(BuildContext context) { return GestureDetector( From 89028500e7c83b66551c65914faf733f142c04e0 Mon Sep 17 00:00:00 2001 From: Serhii Date: Fri, 23 Dec 2022 23:58:39 +0200 Subject: [PATCH 10/14] extract SectionDivider widget --- .../screens/dashboard/widgets/filter_widget.dart | 13 +------------ .../monero_account_list_page.dart | 7 ++----- lib/src/screens/receive/receive_page.dart | 4 ++-- .../send/widgets/choose_yat_address_alert.dart | 6 ++---- .../screens/wallet_keys/wallet_keys_page.dart | 6 ++---- lib/src/widgets/base_alert_dialog.dart | 16 ++++------------ lib/src/widgets/section_divider.dart | 13 +++++++++++++ 7 files changed, 26 insertions(+), 39 deletions(-) create mode 100644 lib/src/widgets/section_divider.dart diff --git a/lib/src/screens/dashboard/widgets/filter_widget.dart b/lib/src/screens/dashboard/widgets/filter_widget.dart index 6831819e4..dd693777b 100644 --- a/lib/src/screens/dashboard/widgets/filter_widget.dart +++ b/lib/src/screens/dashboard/widgets/filter_widget.dart @@ -1,6 +1,7 @@ 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'; @@ -141,15 +142,3 @@ class FilterWidget extends StatelessWidget { ); } } - -class SectionDivider extends StatelessWidget { - const SectionDivider(); - - @override - Widget build(BuildContext context) { - return Container( - height: 1, - color: Theme.of(context).dividerColor, - ); - } -} diff --git a/lib/src/screens/monero_accounts/monero_account_list_page.dart b/lib/src/screens/monero_accounts/monero_account_list_page.dart index 99134369e..c565332a0 100644 --- a/lib/src/screens/monero_accounts/monero_account_list_page.dart +++ b/lib/src/screens/monero_accounts/monero_account_list_page.dart @@ -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'; @@ -83,11 +84,7 @@ class MoneroAccountListPage extends StatelessWidget { ListView.separated( padding: EdgeInsets.zero, controller: controller, - separatorBuilder: (context, index) => - Container( - height: 1, - color: Theme.of(context).dividerColor, - ), + separatorBuilder: (context, index) => SectionDivider(), itemCount: accounts.length ?? 0, itemBuilder: (context, index) { final account = accounts[index]; diff --git a/lib/src/screens/receive/receive_page.dart b/lib/src/screens/receive/receive_page.dart index 6f6b4e31c..4344139ac 100644 --- a/lib/src/screens/receive/receive_page.dart +++ b/lib/src/screens/receive/receive_page.dart @@ -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, _) => SectionDivider(), shrinkWrap: true, physics: NeverScrollableScrollPhysics(), itemCount: addressListViewModel.items.length, diff --git a/lib/src/screens/send/widgets/choose_yat_address_alert.dart b/lib/src/screens/send/widgets/choose_yat_address_alert.dart index 93785743d..dae6c5ad7 100644 --- a/lib/src/screens/send/widgets/choose_yat_address_alert.dart +++ b/lib/src/screens/send/widgets/choose_yat_address_alert.dart @@ -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 { controller: controller, padding: EdgeInsets.all(0), itemCount: itemCount, - separatorBuilder: (_, __) => Container( - height: 1, - color: Theme.of(context).dividerColor, - ), + separatorBuilder: (_, __) => SectionDivider(), itemBuilder: (context, index) { final address = addresses[index]; diff --git a/lib/src/screens/wallet_keys/wallet_keys_page.dart b/lib/src/screens/wallet_keys/wallet_keys_page.dart index f97200e1e..b690cadda 100644 --- a/lib/src/screens/wallet_keys/wallet_keys_page.dart +++ b/lib/src/screens/wallet_keys/wallet_keys_page.dart @@ -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'; @@ -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: SectionDivider(), ), itemCount: walletKeysViewModel.items.length, itemBuilder: (BuildContext context, int index) { diff --git a/lib/src/widgets/base_alert_dialog.dart b/lib/src/widgets/base_alert_dialog.dart index 70370e227..861d1ba9d 100644 --- a/lib/src/widgets/base_alert_dialog.dart +++ b/lib/src/widgets/base_alert_dialog.dart @@ -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, - ), + 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: SectionDivider(), ) : Offstage(), Padding( @@ -152,10 +147,7 @@ class BaseAlertDialog extends StatelessWidget { ) ], ), - Container( - height: 1, - color: Theme.of(context).dividerColor, - ), + SectionDivider(), actionButtons(context) ], ), diff --git a/lib/src/widgets/section_divider.dart b/lib/src/widgets/section_divider.dart new file mode 100644 index 000000000..bef85f975 --- /dev/null +++ b/lib/src/widgets/section_divider.dart @@ -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, + ); + } +} \ No newline at end of file From d893562dad502b69c8dd2f3f196d34f1845f6fcc Mon Sep 17 00:00:00 2001 From: Serhii Date: Sat, 24 Dec 2022 01:09:54 +0200 Subject: [PATCH 11/14] update localization --- .../dashboard/widgets/filter_widget.dart | 25 +++++++++---------- res/values/strings_de.arb | 2 +- res/values/strings_en.arb | 2 +- res/values/strings_es.arb | 2 +- res/values/strings_fr.arb | 2 +- res/values/strings_hi.arb | 2 +- res/values/strings_hr.arb | 2 +- res/values/strings_it.arb | 2 +- res/values/strings_ja.arb | 2 +- res/values/strings_ko.arb | 2 +- res/values/strings_nl.arb | 2 +- res/values/strings_pl.arb | 2 +- res/values/strings_pt.arb | 2 +- res/values/strings_ru.arb | 2 +- res/values/strings_uk.arb | 2 +- res/values/strings_zh.arb | 2 +- 16 files changed, 27 insertions(+), 28 deletions(-) diff --git a/lib/src/screens/dashboard/widgets/filter_widget.dart b/lib/src/screens/dashboard/widgets/filter_widget.dart index dd693777b..86682dcbc 100644 --- a/lib/src/screens/dashboard/widgets/filter_widget.dart +++ b/lib/src/screens/dashboard/widgets/filter_widget.dart @@ -108,19 +108,18 @@ class FilterWidget extends StatelessWidget { // .changeEndDate(picked.last); //} }, - child: Padding( - padding: EdgeInsets.only(left: 32), - child: Text( - item.caption, - style: TextStyle( - color: Colors.red, - //Theme.of(context).primaryTextTheme.title.color,// - fontSize: 18, - fontFamily: 'Lato', - fontWeight: FontWeight.w500, - decoration: TextDecoration.none), - ), - ), + // child: Padding( + // padding: EdgeInsets.only(left: 32), + // child: Text( + // item.caption, + // style: TextStyle( + // color: Theme.of(context).primaryTextTheme.title.color, + // fontSize: 18, + // fontFamily: 'Lato', + // fontWeight: FontWeight.w500, + // decoration: TextDecoration.none), + // ), + // ), ); return FilterTile(child: content); diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index bb01cdaba..152d3226e 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -48,7 +48,7 @@ "outgoing" : "Ausgehend", "transactions_by_date" : "Transaktionen nach Datum", "trades" : "Börsen", - "filters" : "Filtern nach", + "filter_by": "Filtern nach", "today" : "Heute", "yesterday" : "Gestern", "received" : "Empfangen", diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index 8cd6a3942..62306776f 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -48,7 +48,7 @@ "outgoing" : "Outgoing", "transactions_by_date" : "Transactions by date", "trades" : "Trades", - "filters" : "Filter by", + "filter_by": "Filter by", "today" : "Today", "yesterday" : "Yesterday", "received" : "Received", diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index 63fca7fbf..ef3eb6e06 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -48,7 +48,7 @@ "outgoing" : "Saliente", "transactions_by_date" : "Transacciones por fecha", "trades" : "Cambios", - "filters" : "Filtrado por", + "filter_by": "Filtrado por", "today" : "Hoy", "yesterday" : "Ayer", "received" : "Recibido", diff --git a/res/values/strings_fr.arb b/res/values/strings_fr.arb index dc975ac24..2cd961cc1 100644 --- a/res/values/strings_fr.arb +++ b/res/values/strings_fr.arb @@ -46,7 +46,7 @@ "outgoing" : "Sortantes", "transactions_by_date" : "Transactions par date", "trades" : "Échanges", - "filters" : "Filtrer par", + "filter_by": "Filtrer par", "today" : "Aujourd'hui", "yesterday" : "Hier", "received" : "Reçus", diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index 7cb5ff132..947e1574f 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -48,7 +48,7 @@ "outgoing" : "निवर्तमान", "transactions_by_date" : "तारीख से लेन-देन", "trades" : "ट्रेडों", - "filters" : "के द्वारा छनित", + "filter_by": "के द्वारा छनित", "today" : "आज", "yesterday" : "बिता कल", "received" : "प्राप्त किया", diff --git a/res/values/strings_hr.arb b/res/values/strings_hr.arb index b2696a3df..432cf8fd0 100644 --- a/res/values/strings_hr.arb +++ b/res/values/strings_hr.arb @@ -48,7 +48,7 @@ "outgoing" : "Odlazno", "transactions_by_date" : "Transakcije prema datumu", "trades" : "Razmjene", - "filters" : "Filtrirati po", + "filter_by": "Filtrirati po", "today" : "Danas", "yesterday" : "Jučer", "received" : "Primljeno", diff --git a/res/values/strings_it.arb b/res/values/strings_it.arb index cb68d9ea6..218c6e33b 100644 --- a/res/values/strings_it.arb +++ b/res/values/strings_it.arb @@ -48,7 +48,7 @@ "outgoing" : "In uscita", "transactions_by_date" : "Transazioni per data", "trades" : "Scambi", - "filters" : "Filtrirati po", + "filter_by": "Filtrirati po", "today" : "Oggi", "yesterday" : "Ieri", "received" : "Ricevuto", diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index f0d595c6e..6770d7f0c 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -48,7 +48,7 @@ "outgoing" : "発信", "transactions_by_date" : "日付ごとの取引", "trades" : "取引", - "filters" : "でフィルタリング", + "filter_by": "でフィルタリング", "today" : "今日", "yesterday" : "昨日", "received" : "受け取った", diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index f4d289287..bef8c3477 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -48,7 +48,7 @@ "outgoing" : "나가는", "transactions_by_date" : "날짜 별 거래", "trades" : "거래", - "filters" : "필터링 기준", + "filter_by": "필터링 기준", "today" : "오늘", "yesterday" : "어제", "received" : "받았습니다", diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index 06c075092..706986be6 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -48,7 +48,7 @@ "outgoing" : "Uitgaande", "transactions_by_date" : "Transacties op datum", "trades" : "Trades", - "filters" : "Filteren op", + "filter_by": "Filteren op", "today" : "Vandaag", "yesterday" : "Gisteren", "received" : "Ontvangen", diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index 64e5f508b..1f708df9e 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -48,7 +48,7 @@ "outgoing" : "Towarzyski", "transactions_by_date" : "Transakcje według daty", "trades" : "Transakcje", - "filters" : "Filtruj według", + "filter_by": "Filtruj według", "today" : "Dzisiaj", "yesterday" : "Wczoraj", "received" : "Odebrane", diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index b23aa20e8..909ce87e6 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -48,7 +48,7 @@ "outgoing" : "Enviadas", "transactions_by_date" : "Transações por data", "trades" : "Trocas", - "filters" : "Filtrar por", + "filter_by": "Filtrar por", "today" : "Hoje", "yesterday" : "Ontem", "received" : "Recebida", diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index 40f6ccdf0..f9376e6f1 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -48,7 +48,7 @@ "outgoing" : "Исходящие", "transactions_by_date" : "Сортировать по дате", "trades" : "Сделки", - "filters" : "Фильтровать по", + "filter_by": "Фильтровать по", "today" : "Сегодня", "yesterday" : "Вчера", "received" : "Полученные", diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index 9108c700d..030573c32 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -48,7 +48,7 @@ "outgoing" : "Вихідні", "transactions_by_date" : "Сортувати по даті", "trades" : "Торгові операції", - "filters" : "Фільтрувати по", + "filter_by": "Фільтрувати по", "today" : "Сьогодні", "yesterday" : "Вчора", "received" : "Отримані", diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index 4683bb068..b49880b21 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -48,7 +48,7 @@ "outgoing" : "发送", "transactions_by_date" : "按日期交易", "trades" : "交易", - "filters" : "过滤", + "filter_by": "过滤", "today" : "今天", "yesterday" : "昨天", "received" : "已收到", From ca79052914ca72253fd8e0e4b7b859f28ef96b71 Mon Sep 17 00:00:00 2001 From: Serhii Date: Mon, 26 Dec 2022 20:41:21 +0200 Subject: [PATCH 12/14] PR fixes --- .../dashboard/widgets/filter_widget.dart | 2 +- lib/store/dashboard/trade_filter_store.dart | 91 +++++++++---------- .../dashboard/transaction_filter_store.dart | 56 +++++------- .../dashboard/dashboard_view_model.dart | 16 ++-- lib/view_model/dashboard/filter_item.dart | 2 +- 5 files changed, 79 insertions(+), 88 deletions(-) diff --git a/lib/src/screens/dashboard/widgets/filter_widget.dart b/lib/src/screens/dashboard/widgets/filter_widget.dart index 86682dcbc..cf6650301 100644 --- a/lib/src/screens/dashboard/widgets/filter_widget.dart +++ b/lib/src/screens/dashboard/widgets/filter_widget.dart @@ -82,7 +82,7 @@ class FilterWidget extends StatelessWidget { final content = item.onChanged != null ? Observer( builder: (_) => StandardCheckbox( - value: item.value.value, + value: item.value(), caption: item.caption, gradientBackground: true, borderColor: Theme.of(context).dividerColor, diff --git a/lib/store/dashboard/trade_filter_store.dart b/lib/store/dashboard/trade_filter_store.dart index 9c1dc9a9a..87fa749a9 100644 --- a/lib/store/dashboard/trade_filter_store.dart +++ b/lib/store/dashboard/trade_filter_store.dart @@ -8,60 +8,61 @@ part'trade_filter_store.g.dart'; class TradeFilterStore = TradeFilterStoreBase with _$TradeFilterStore; abstract class TradeFilterStoreBase with Store { - TradeFilterStoreBase(); + TradeFilterStoreBase() : displayXMRTO = true, + displayChangeNow = true, + displaySideShift = true, + displayMorphToken = true, + displaySimpleSwap = true; - Observable displayXMRTO = Observable(true); - Observable displayAllTrades = Observable(true); - Observable displayChangeNow = Observable(true); - Observable displaySideShift = Observable(true); - Observable displayMorphToken = Observable(true); - Observable displaySimpleSwap = Observable(true); + @observable + bool displayXMRTO; + + @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: - displayAllTrades.value = false; - displayChangeNow.value = !displayChangeNow.value; - if (displayChangeNow.value && displaySideShift.value && displaySimpleSwap.value) { - displayAllTrades.value = true; - } + displayChangeNow = !displayChangeNow; break; case ExchangeProviderDescription.sideShift: - displayAllTrades.value = false; - displaySideShift.value = !displaySideShift.value; - if (displayChangeNow.value && displaySideShift.value && displaySimpleSwap.value) { - displayAllTrades.value = true; - } + displaySideShift = !displaySideShift; break; case ExchangeProviderDescription.simpleSwap: - displayAllTrades.value = false; - displaySimpleSwap.value = !displaySimpleSwap.value; - if (displayChangeNow.value && displaySideShift.value && displaySimpleSwap.value) { - displayAllTrades.value = true; - } + displaySimpleSwap = !displaySimpleSwap; break; case ExchangeProviderDescription.xmrto: - displayXMRTO.value = !displayXMRTO.value; + displayXMRTO = !displayXMRTO; break; case ExchangeProviderDescription.morphToken: - displayMorphToken.value = !displayMorphToken.value; + displayMorphToken = !displayMorphToken; break; case ExchangeProviderDescription.all: - displayAllTrades.value = !displayAllTrades.value; - if (displayAllTrades.value) { - displayChangeNow.value = true; - displaySideShift.value = true; - displayXMRTO.value = true; - displayMorphToken.value = true; - displaySimpleSwap.value = true; - } - if (!displayAllTrades.value) { - displayChangeNow.value = false; - displaySideShift.value = false; - displayXMRTO.value = false; - displayMorphToken.value = false; - displaySimpleSwap.value = false; + if (displayAllTrades) { + displayChangeNow = false; + displaySideShift = false; + displayXMRTO = false; + displayMorphToken = false; + displaySimpleSwap = false; + } else { + displayChangeNow = true; + displaySideShift = true; + displayXMRTO = true; + displayMorphToken = true; + displaySimpleSwap = true; } break; } @@ -70,24 +71,22 @@ abstract class TradeFilterStoreBase with Store { List filtered({required List trades, required WalletBase wallet}) { final _trades = trades.where((item) => item.trade.walletId == wallet.id).toList(); - final needToFilter = !displayChangeNow.value || !displaySideShift.value - || !displayXMRTO.value || !displayMorphToken.value - || !displaySimpleSwap.value; + final needToFilter = !displayAllTrades; return needToFilter ? _trades .where((item) => - (displayXMRTO.value && + (displayXMRTO && item.trade.provider == ExchangeProviderDescription.xmrto) || - (displaySideShift.value && + (displaySideShift && item.trade.provider == ExchangeProviderDescription.sideShift) || - (displayChangeNow.value && + (displayChangeNow && item.trade.provider == ExchangeProviderDescription.changeNow) || - (displayMorphToken.value && + (displayMorphToken && item.trade.provider == ExchangeProviderDescription.morphToken) - ||(displaySimpleSwap.value && + ||(displaySimpleSwap && item.trade.provider == ExchangeProviderDescription.simpleSwap)) .toList() diff --git a/lib/store/dashboard/transaction_filter_store.dart b/lib/store/dashboard/transaction_filter_store.dart index 4198f7d8c..95264a23d 100644 --- a/lib/store/dashboard/transaction_filter_store.dart +++ b/lib/store/dashboard/transaction_filter_store.dart @@ -10,11 +10,14 @@ class TransactionFilterStore = TransactionFilterStoreBase with _$TransactionFilterStore; abstract class TransactionFilterStoreBase with Store { - TransactionFilterStoreBase(); + TransactionFilterStoreBase() : displayIncoming = true, + displayOutgoing = true; - Observable displayAll = Observable(true); - Observable displayIncoming = Observable(true); - Observable displayOutgoing = Observable(true); + @observable + bool displayIncoming; + + @observable + bool displayOutgoing; @observable DateTime? startDate; @@ -22,40 +25,30 @@ abstract class TransactionFilterStoreBase with Store { @observable DateTime? endDate; + @computed + bool get displayAll => displayIncoming && displayOutgoing; + @action - void toggleIAll() { - displayAll.value = (!displayAll.value); - if (displayAll.value) { - displayOutgoing.value = true; - displayIncoming.value = true; - } - if (!displayAll.value) { - displayOutgoing.value = false; - displayIncoming.value = false; + void toggleAll() { + if (displayAll) { + displayOutgoing = false; + displayIncoming = false; + } else { + displayOutgoing = true; + displayIncoming = true; } } + @action void toggleIncoming() { - displayIncoming.value = (!displayIncoming.value); - if (displayIncoming.value && displayOutgoing.value) { - displayAll.value = true; - } - if (!displayIncoming.value || !displayOutgoing.value) { - displayAll.value = false; - } + displayIncoming = !displayIncoming; } @action void toggleOutgoing() { - displayOutgoing.value = (!displayOutgoing.value); - if (displayIncoming.value && displayOutgoing.value) { - displayAll.value = true; - } - if (!displayIncoming.value || !displayOutgoing.value) { - displayAll.value = false; - } + displayOutgoing = !displayOutgoing; } @action @@ -66,8 +59,7 @@ abstract class TransactionFilterStoreBase with Store { List filtered({required List transactions}) { var _transactions = []; - final needToFilter = !displayOutgoing.value || - !displayIncoming.value || + final needToFilter = !displayAll || (startDate != null && endDate != null); if (needToFilter) { @@ -79,11 +71,11 @@ abstract class TransactionFilterStoreBase with Store { && (endDate?.isAfter(item.transaction.date) ?? false); } - if (allowed && (!displayOutgoing.value || !displayIncoming.value)) { - allowed = (displayOutgoing.value && + if (allowed && (!displayAll)) { + allowed = (displayOutgoing && item.transaction.direction == TransactionDirection.outgoing) || - (displayIncoming.value && + (displayIncoming && item.transaction.direction == TransactionDirection.incoming); } diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart index ba0f9f8ff..57720d92f 100644 --- a/lib/view_model/dashboard/dashboard_view_model.dart +++ b/lib/view_model/dashboard/dashboard_view_model.dart @@ -59,15 +59,15 @@ abstract class DashboardViewModelBase with Store { filterItems = { S.current.transactions: [ FilterItem( - value: transactionFilterStore.displayAll, + value: () => transactionFilterStore.displayAll, caption: S.current.all_transactions, - onChanged: transactionFilterStore.toggleIAll), + onChanged: transactionFilterStore.toggleAll), FilterItem( - value: transactionFilterStore.displayIncoming, + value: () => transactionFilterStore.displayIncoming, caption: S.current.incoming, onChanged:transactionFilterStore.toggleIncoming), FilterItem( - value: transactionFilterStore.displayOutgoing, + value: () => transactionFilterStore.displayOutgoing, caption: S.current.outgoing, onChanged: transactionFilterStore.toggleOutgoing), // FilterItem( @@ -77,22 +77,22 @@ abstract class DashboardViewModelBase with Store { ], S.current.trades: [ FilterItem( - value: tradeFilterStore.displayAllTrades, + value: () => tradeFilterStore.displayAllTrades, caption: S.current.all_trades, onChanged: () => tradeFilterStore .toggleDisplayExchange(ExchangeProviderDescription.all)), FilterItem( - value: tradeFilterStore.displayChangeNow, + value: () => tradeFilterStore.displayChangeNow, caption: ExchangeProviderDescription.changeNow.title, onChanged: () => tradeFilterStore .toggleDisplayExchange(ExchangeProviderDescription.changeNow)), FilterItem( - value: tradeFilterStore.displaySideShift, + value: () => tradeFilterStore.displaySideShift, caption: ExchangeProviderDescription.sideShift.title, onChanged: () => tradeFilterStore .toggleDisplayExchange(ExchangeProviderDescription.sideShift)), FilterItem( - value: tradeFilterStore.displaySimpleSwap, + value: () => tradeFilterStore.displaySimpleSwap, caption: ExchangeProviderDescription.simpleSwap.title, onChanged: () => tradeFilterStore .toggleDisplayExchange(ExchangeProviderDescription.simpleSwap)), diff --git a/lib/view_model/dashboard/filter_item.dart b/lib/view_model/dashboard/filter_item.dart index 8bc0f0bf1..0944e899c 100644 --- a/lib/view_model/dashboard/filter_item.dart +++ b/lib/view_model/dashboard/filter_item.dart @@ -6,7 +6,7 @@ class FilterItem { required this.caption, required this.onChanged}); - Observable value; + bool Function() value; String caption; Function onChanged; } \ No newline at end of file From dec818a27a3f054c6b386e56bf661b85d9ae9d9f Mon Sep 17 00:00:00 2001 From: Serhii Date: Mon, 26 Dec 2022 21:18:52 +0200 Subject: [PATCH 13/14] fix localisation key name --- lib/src/screens/dashboard/widgets/filter_widget.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/screens/dashboard/widgets/filter_widget.dart b/lib/src/screens/dashboard/widgets/filter_widget.dart index cf6650301..8dcc1b5c3 100644 --- a/lib/src/screens/dashboard/widgets/filter_widget.dart +++ b/lib/src/screens/dashboard/widgets/filter_widget.dart @@ -38,7 +38,7 @@ class FilterWidget extends StatelessWidget { Padding( padding: EdgeInsets.all(24.0), child: Text( - S.of(context).filters, + S.of(context).filter_by, style: TextStyle( color: Theme.of(context).primaryTextTheme.overline!.color!, fontSize: 16, From daa9fc4acc77e38f9919e9877cb78f7483a6b742 Mon Sep 17 00:00:00 2001 From: Serhii Date: Wed, 28 Dec 2022 14:00:59 +0200 Subject: [PATCH 14/14] minor fixes --- .../dashboard/widgets/filter_widget.dart | 40 ++----------------- .../exchange_trade/exchange_trade_page.dart | 4 +- .../monero_account_list_page.dart | 3 +- .../order_details/order_details_page.dart | 6 +-- lib/src/screens/receive/receive_page.dart | 2 +- .../widgets/choose_yat_address_alert.dart | 2 +- .../trade_details/trade_details_page.dart | 6 +-- .../transaction_details_page.dart | 6 +-- .../unspent_coins_details_page.dart | 4 +- .../screens/wallet_keys/wallet_keys_page.dart | 6 +-- lib/src/widgets/base_alert_dialog.dart | 6 +-- .../{standard_list_row.dart => list_row.dart} | 4 +- 12 files changed, 28 insertions(+), 61 deletions(-) rename lib/src/widgets/{standard_list_row.dart => list_row.dart} (96%) diff --git a/lib/src/screens/dashboard/widgets/filter_widget.dart b/lib/src/screens/dashboard/widgets/filter_widget.dart index 8dcc1b5c3..17df0bc5e 100644 --- a/lib/src/screens/dashboard/widgets/filter_widget.dart +++ b/lib/src/screens/dashboard/widgets/filter_widget.dart @@ -20,7 +20,7 @@ class FilterWidget extends StatelessWidget { @override Widget build(BuildContext context) { - const sectionDivider = SectionDivider(); + const sectionDivider = const SectionDivider(); return AlertBackground( child: Stack( alignment: Alignment.center, @@ -79,8 +79,7 @@ class FilterWidget extends StatelessWidget { itemCount: section.length, itemBuilder: (_, index2) { final item = section[index2]; - final content = item.onChanged != null - ? Observer( + final content = Observer( builder: (_) => StandardCheckbox( value: item.value(), caption: item.caption, @@ -88,40 +87,7 @@ class FilterWidget extends StatelessWidget { borderColor: Theme.of(context).dividerColor, iconColor: Colors.white, onChanged: (value) => item.onChanged(), - )) - : GestureDetector( - onTap: () async { - //final List 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.title.color, - // fontSize: 18, - // fontFamily: 'Lato', - // fontWeight: FontWeight.w500, - // decoration: TextDecoration.none), - // ), - // ), - ); - + )); return FilterTile(child: content); }, ) diff --git a/lib/src/screens/exchange_trade/exchange_trade_page.dart b/lib/src/screens/exchange_trade/exchange_trade_page.dart index e3eb8db96..5aacf3f1f 100644 --- a/lib/src/screens/exchange_trade/exchange_trade_page.dart +++ b/lib/src/screens/exchange_trade/exchange_trade_page.dart @@ -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/standard_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 { final item = widget.exchangeTradeViewModel.items[index]; final value = item.data ?? fetchingLabel; - final content = AnotherStandardListRow( + final content = ListRow( title: item.title, value: value, valueFontSize: 14, diff --git a/lib/src/screens/monero_accounts/monero_account_list_page.dart b/lib/src/screens/monero_accounts/monero_account_list_page.dart index c565332a0..7fe15948f 100644 --- a/lib/src/screens/monero_accounts/monero_account_list_page.dart +++ b/lib/src/screens/monero_accounts/monero_account_list_page.dart @@ -84,7 +84,8 @@ class MoneroAccountListPage extends StatelessWidget { ListView.separated( padding: EdgeInsets.zero, controller: controller, - separatorBuilder: (context, index) => SectionDivider(), + separatorBuilder: (context, index) => + const SectionDivider(), itemCount: accounts.length ?? 0, itemBuilder: (context, index) { final account = accounts[index]; diff --git a/lib/src/screens/order_details/order_details_page.dart b/lib/src/screens/order_details/order_details_page.dart index a7eff99b8..0784c7008 100644 --- a/lib/src/screens/order_details/order_details_page.dart +++ b/lib/src/screens/order_details/order_details_page.dart @@ -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/standard_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 { if (item is TrackTradeListItem) { return GestureDetector( onTap: item.onTap, - child: AnotherStandardListRow( + child: ListRow( title: '${item.title}', value: '${item.value}')); } else { return GestureDetector( @@ -65,7 +65,7 @@ class OrderDetailsPageBodyState extends State { Clipboard.setData(ClipboardData(text: '${item.value}')); showBar(context, S.of(context).copied_to_clipboard); }, - child: AnotherStandardListRow( + child: ListRow( title: '${item.title}', value: '${item.value}')); } }); diff --git a/lib/src/screens/receive/receive_page.dart b/lib/src/screens/receive/receive_page.dart index 4344139ac..71ee578a0 100644 --- a/lib/src/screens/receive/receive_page.dart +++ b/lib/src/screens/receive/receive_page.dart @@ -136,7 +136,7 @@ class ReceivePage extends BasePage { Observer( builder: (_) => ListView.separated( padding: EdgeInsets.all(0), - separatorBuilder: (context, _) => SectionDivider(), + separatorBuilder: (context, _) => const SectionDivider(), shrinkWrap: true, physics: NeverScrollableScrollPhysics(), itemCount: addressListViewModel.items.length, diff --git a/lib/src/screens/send/widgets/choose_yat_address_alert.dart b/lib/src/screens/send/widgets/choose_yat_address_alert.dart index dae6c5ad7..5d937a571 100644 --- a/lib/src/screens/send/widgets/choose_yat_address_alert.dart +++ b/lib/src/screens/send/widgets/choose_yat_address_alert.dart @@ -71,7 +71,7 @@ class ChooseYatAddressButtonsState extends State { controller: controller, padding: EdgeInsets.all(0), itemCount: itemCount, - separatorBuilder: (_, __) => SectionDivider(), + separatorBuilder: (_, __) => const SectionDivider(), itemBuilder: (context, index) { final address = addresses[index]; diff --git a/lib/src/screens/trade_details/trade_details_page.dart b/lib/src/screens/trade_details/trade_details_page.dart index 1bb5d3ec8..1958a7d58 100644 --- a/lib/src/screens/trade_details/trade_details_page.dart +++ b/lib/src/screens/trade_details/trade_details_page.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/standard_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,7 +62,7 @@ class TradeDetailsPageBodyState extends State { if (item is TrackTradeListItem) { return GestureDetector( onTap: item.onTap, - child: AnotherStandardListRow( + child: ListRow( title: '${item.title}', value: '${item.value}')); } @@ -86,7 +86,7 @@ class TradeDetailsPageBodyState extends State { Clipboard.setData(ClipboardData(text: '${item.value}')); showBar(context, S.of(context).copied_to_clipboard); }, - child: AnotherStandardListRow( + child: ListRow( title: '${item.title}', value: '${item.value}')); }); }); diff --git a/lib/src/screens/transaction_details/transaction_details_page.dart b/lib/src/screens/transaction_details/transaction_details_page.dart index 8d3ae8c9e..1b79ceeb0 100644 --- a/lib/src/screens/transaction_details/transaction_details_page.dart +++ b/lib/src/screens/transaction_details/transaction_details_page.dart @@ -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/standard_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: - AnotherStandardListRow(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: - AnotherStandardListRow(title: '${item.title}:', value: item.value), + ListRow(title: '${item.title}:', value: item.value), ); } diff --git a/lib/src/screens/unspent_coins/unspent_coins_details_page.dart b/lib/src/screens/unspent_coins/unspent_coins_details_page.dart index 74fbcfdd9..d8ce24d88 100644 --- a/lib/src/screens/unspent_coins/unspent_coins_details_page.dart +++ b/lib/src/screens/unspent_coins/unspent_coins_details_page.dart @@ -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/standard_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 AnotherStandardListRow( + return ListRow( title: '${item.title}:', value: item.value); } diff --git a/lib/src/screens/wallet_keys/wallet_keys_page.dart b/lib/src/screens/wallet_keys/wallet_keys_page.dart index b690cadda..e81ec7d2a 100644 --- a/lib/src/screens/wallet_keys/wallet_keys_page.dart +++ b/lib/src/screens/wallet_keys/wallet_keys_page.dart @@ -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/standard_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 { @@ -58,7 +58,7 @@ class WalletKeysPage extends BasePage { height: 1, padding: EdgeInsets.only(left: 24), color: Theme.of(context).accentTextTheme!.headline6!.backgroundColor!, - child: SectionDivider(), + child: const SectionDivider(), ), itemCount: walletKeysViewModel.items.length, itemBuilder: (BuildContext context, int index) { @@ -69,7 +69,7 @@ class WalletKeysPage extends BasePage { Clipboard.setData(ClipboardData(text: item.value)); showBar(context, S.of(context).copied_key_to_clipboard(item.title)); }, - child: AnotherStandardListRow( + child: ListRow( title: item.title + ':', value: item.value, ), diff --git a/lib/src/widgets/base_alert_dialog.dart b/lib/src/widgets/base_alert_dialog.dart index 861d1ba9d..effbbc562 100644 --- a/lib/src/widgets/base_alert_dialog.dart +++ b/lib/src/widgets/base_alert_dialog.dart @@ -77,7 +77,7 @@ class BaseAlertDialog extends StatelessWidget { ), )), ), - SectionDivider(), + const SectionDivider(), Expanded( child: TextButton( onPressed: actionRight, @@ -138,7 +138,7 @@ class BaseAlertDialog extends StatelessWidget { isDividerExists ? Padding( padding: EdgeInsets.only(top: 16, bottom: 8), - child: SectionDivider(), + child: const SectionDivider(), ) : Offstage(), Padding( @@ -147,7 +147,7 @@ class BaseAlertDialog extends StatelessWidget { ) ], ), - SectionDivider(), + const SectionDivider(), actionButtons(context) ], ), diff --git a/lib/src/widgets/standard_list_row.dart b/lib/src/widgets/list_row.dart similarity index 96% rename from lib/src/widgets/standard_list_row.dart rename to lib/src/widgets/list_row.dart index e174acc50..40824fe59 100644 --- a/lib/src/widgets/standard_list_row.dart +++ b/lib/src/widgets/list_row.dart @@ -1,8 +1,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class AnotherStandardListRow extends StatelessWidget { - AnotherStandardListRow( +class ListRow extends StatelessWidget { + ListRow( {required this.title, required this.value, this.titleFontSize = 14,