filter paired currency from all list

This commit is contained in:
julian 2023-02-21 13:40:11 -06:00
parent 66e65736a5
commit 812897a3cb

View file

@ -160,17 +160,24 @@ class _ExchangeCurrencySelectionViewState
}
List<Currency> filter(String text) {
if (text.isEmpty) {
return _currencies;
}
if (widget.pairedTicker == null) {
if (text.isEmpty) {
return _currencies;
}
return _currencies
.where((e) =>
e.name.toLowerCase().contains(text.toLowerCase()) ||
e.ticker.toLowerCase().contains(text.toLowerCase()))
.toList(growable: false);
} else {
if (text.isEmpty) {
return _currencies
.where((e) =>
e.ticker.toLowerCase() != widget.pairedTicker!.toLowerCase())
.toList(growable: false);
}
return _currencies
.where((e) =>
e.ticker.toLowerCase() != widget.pairedTicker!.toLowerCase() &&