CWA-169 | added MorphTokenExchangeProvider to dashboard page, trade filter store. Added morph icon to trade row

This commit is contained in:
Oleksandr Sobol 2020-02-05 22:54:55 +02:00
parent 2373b06d52
commit 95222ecbae
3 changed files with 37 additions and 3 deletions

View file

@ -480,7 +480,28 @@ class DashboardPageBodyState extends State<DashboardPageBody> {
ExchangeProviderDescription
.changeNow),
)
])))
]))),
PopupMenuItem(
value: 5,
child: Observer(
builder: (_) => Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text('MorphToken'),
Checkbox(
value: actionListStore
.tradeFilterStore
.displayMorphToken,
onChanged: (value) =>
actionListStore
.tradeFilterStore
.toggleDisplayExchange(
ExchangeProviderDescription
.morphToken),
)
])))
],
child: Text(S.of(context).filters,
style: TextStyle(

View file

@ -82,6 +82,9 @@ class TradeRow extends StatelessWidget {
case ExchangeProviderDescription.changeNow:
image = Image.asset('assets/images/change_now.png');
break;
case ExchangeProviderDescription.morphToken:
image = Image.asset('assets/images/morph_icon.png');
break;
default:
image = null;
}

View file

@ -11,6 +11,7 @@ abstract class TradeFilterStoreBase with Store {
TradeFilterStoreBase(
{this.displayXMRTO = true,
this.displayChangeNow = true,
this.displayMorphToken = true,
this.walletStore});
@observable
@ -19,6 +20,9 @@ abstract class TradeFilterStoreBase with Store {
@observable
bool displayChangeNow;
@observable
bool displayMorphToken;
WalletStore walletStore;
@action
@ -30,13 +34,16 @@ abstract class TradeFilterStoreBase with Store {
case ExchangeProviderDescription.xmrto:
displayXMRTO = !displayXMRTO;
break;
case ExchangeProviderDescription.morphToken:
displayMorphToken = !displayMorphToken;
break;
}
}
List<TradeListItem> filtered({List<TradeListItem> trades}) {
final _trades =
trades.where((item) => item.trade.walletId == walletStore.id).toList();
final needToFilter = !displayChangeNow || !displayXMRTO;
final needToFilter = !displayChangeNow || !displayXMRTO || !displayMorphToken;
return needToFilter
? trades
@ -45,7 +52,10 @@ abstract class TradeFilterStoreBase with Store {
item.trade.provider == ExchangeProviderDescription.xmrto) ||
(displayChangeNow &&
item.trade.provider ==
ExchangeProviderDescription.changeNow))
ExchangeProviderDescription.changeNow) ||
(displayMorphToken &&
item.trade.provider ==
ExchangeProviderDescription.morphToken))
.toList()
: _trades;
}