mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-16 17:27:37 +00:00
hide picker after the country is set
This commit is contained in:
parent
b534e4871d
commit
cce358b94f
3 changed files with 44 additions and 26 deletions
|
@ -376,6 +376,10 @@ class Country extends EnumerableItem<String> with Serializable<String> {
|
||||||
return _all.values.firstWhereOrNull((element) => element.raw == countryCode.toLowerCase());
|
return _all.values.firstWhereOrNull((element) => element.raw == countryCode.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Country? fromFullName(String fullName) {
|
||||||
|
return _all.values.firstWhereOrNull((element) => element.fullName == fullName);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) => other is Country && other.raw == raw;
|
bool operator ==(Object other) => other is Country && other.raw == raw;
|
||||||
|
|
||||||
|
|
|
@ -119,6 +119,8 @@ class CakePayCardsPage extends BasePage {
|
||||||
_cardsListViewModel.getVendors();
|
_cardsListViewModel.getVendors();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 5),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 6),
|
padding: EdgeInsets.symmetric(horizontal: 6),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
@ -153,6 +155,7 @@ class CakePayCardsPage extends BasePage {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
|
@ -169,7 +172,7 @@ class CakePayCardsPage extends BasePage {
|
||||||
)),
|
)),
|
||||||
SizedBox(width: 5),
|
SizedBox(width: 5),
|
||||||
filterButton,
|
filterButton,
|
||||||
SizedBox(width: 5),
|
if (_cardsListViewModel.showCountryPicker)
|
||||||
_countryPicker
|
_countryPicker
|
||||||
])),
|
])),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
|
|
|
@ -5,6 +5,7 @@ import 'package:cake_wallet/entities/country.dart';
|
||||||
import 'package:cake_wallet/entities/fiat_currency.dart';
|
import 'package:cake_wallet/entities/fiat_currency.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
import 'package:cake_wallet/store/settings_store.dart';
|
import 'package:cake_wallet/store/settings_store.dart';
|
||||||
|
import 'package:cake_wallet/view_model/dashboard/dropdown_filter_item.dart';
|
||||||
import 'package:cake_wallet/view_model/dashboard/filter_item.dart';
|
import 'package:cake_wallet/view_model/dashboard/filter_item.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
|
|
||||||
|
@ -70,6 +71,14 @@ abstract class CakePayCardsListViewModelBase with Store {
|
||||||
caption: S.current.custom_value,
|
caption: S.current.custom_value,
|
||||||
onChanged: toggleCustomValueCards),
|
onChanged: toggleCustomValueCards),
|
||||||
],
|
],
|
||||||
|
S.current.countries: [
|
||||||
|
DropdownFilterItem(
|
||||||
|
items: availableCountries.map((e) => e.title).toList(),
|
||||||
|
caption: '',
|
||||||
|
selectedItem: selectedCountry.title,
|
||||||
|
onItemSelected: (String value) => setSelectedCountry(Country.fromFullName(value)!),
|
||||||
|
),
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
String searchString;
|
String searchString;
|
||||||
|
@ -121,6 +130,8 @@ abstract class CakePayCardsListViewModelBase with Store {
|
||||||
Country get selectedCountry =>
|
Country get selectedCountry =>
|
||||||
settingsStore.selectedCakePayCountry ?? _getInitialCountry(settingsStore.fiatCurrency);
|
settingsStore.selectedCakePayCountry ?? _getInitialCountry(settingsStore.fiatCurrency);
|
||||||
|
|
||||||
|
bool get showCountryPicker => settingsStore.selectedCakePayCountry == null;
|
||||||
|
|
||||||
bool get hasFiltersChanged =>
|
bool get hasFiltersChanged =>
|
||||||
settingsStore.selectedCakePayCountry != _initialSelectedCountry ||
|
settingsStore.selectedCakePayCountry != _initialSelectedCountry ||
|
||||||
displayPrepaidCards != _initialDisplayPrepaidCards ||
|
displayPrepaidCards != _initialDisplayPrepaidCards ||
|
||||||
|
|
Loading…
Reference in a new issue