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,6 +480,27 @@ class DashboardPageBodyState extends State<DashboardPageBody> {
ExchangeProviderDescription ExchangeProviderDescription
.changeNow), .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, child: Text(S.of(context).filters,

View file

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

View file

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