mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 12:09:43 +00:00
Finalize Country picker
This commit is contained in:
parent
dd405cfd14
commit
eab5010f52
17 changed files with 102 additions and 17 deletions
|
@ -1,3 +1,5 @@
|
|||
import 'package:cake_wallet/src/widgets/picker.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:country_pickers/country.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
@ -142,21 +144,88 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
|
|||
),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
CountryPickerUtils.getFlagImageAssetPath(selectedCountry.isoCode),
|
||||
height: 20.0,
|
||||
width: 36.0,
|
||||
fit: BoxFit.fill,
|
||||
package: "country_pickers",
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8, right: 6),
|
||||
child: Text(selectedCountry.name),
|
||||
),
|
||||
Text(selectedCountry.phoneCode),
|
||||
]
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (_) => Picker(
|
||||
items: countryList,
|
||||
displayItem: (dynamic country) {
|
||||
final Country _country = country as Country;
|
||||
return "${_country.name} (+${_country.phoneCode})";
|
||||
},
|
||||
selectedAtIndex: countryList.indexOf(selectedCountry),
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
onItemSelected: (Country country) {
|
||||
// TODO: update view model
|
||||
selectedCountry = country;
|
||||
setState(() {});
|
||||
},
|
||||
images: countryList
|
||||
.map((e) => Image.asset(
|
||||
CountryPickerUtils.getFlagImageAssetPath(e.isoCode),
|
||||
height: 20.0,
|
||||
width: 36.0,
|
||||
fit: BoxFit.fill,
|
||||
package: "country_pickers",
|
||||
))
|
||||
.toList(),
|
||||
isSeparated: false,
|
||||
hintText: S.of(context).search_country,
|
||||
matchingCriteria: (dynamic country, String searchText) {
|
||||
final Country _country = country as Country;
|
||||
searchText = searchText.toLowerCase();
|
||||
return _country.name.toLowerCase().contains(searchText) ||
|
||||
_country.phoneCode.contains(searchText) ||
|
||||
_country.isoCode.toLowerCase().contains(searchText) ||
|
||||
_country.iso3Code.toLowerCase().contains(searchText);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
CountryPickerUtils.getFlagImageAssetPath(selectedCountry.isoCode),
|
||||
height: 20.0,
|
||||
width: 36.0,
|
||||
fit: BoxFit.fill,
|
||||
package: "country_pickers",
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 8, right: 6),
|
||||
child: Text(
|
||||
selectedCountry.name,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"(+${selectedCountry.phoneCode})",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
size: 16,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -123,7 +123,8 @@ abstract class SettingsViewModelBase with Store {
|
|||
.toList(),
|
||||
isGridView: true,
|
||||
matchingCriteria: (FiatCurrency currency, String searchText) {
|
||||
return currency.title.toLowerCase().contains(searchText) || currency.fullName.toLowerCase().contains(searchText);
|
||||
return currency.title.toLowerCase().contains(searchText.toLowerCase())
|
||||
|| currency.fullName.toLowerCase().contains(searchText.toLowerCase());
|
||||
},
|
||||
),
|
||||
PickerListItem(
|
||||
|
@ -179,7 +180,7 @@ abstract class SettingsViewModelBase with Store {
|
|||
(e) => Image.asset("assets/images/flags/${LanguageService.localeCountryCode[e]}.png"))
|
||||
.toList(),
|
||||
matchingCriteria: (String code, String searchText) {
|
||||
return LanguageService.list[code].toLowerCase().contains(searchText);
|
||||
return LanguageService.list[code].toLowerCase().contains(searchText.toLowerCase());
|
||||
},
|
||||
),
|
||||
SwitcherListItem(
|
||||
|
|
|
@ -532,6 +532,7 @@
|
|||
"search": "Suche",
|
||||
"search_language": "Sprache suchen",
|
||||
"search_currency": "Währung suchen",
|
||||
"search_country": "Land suchen",
|
||||
"new_template" : "neue Vorlage",
|
||||
"electrum_address_disclaimer": "Wir generieren jedes Mal neue Adressen, wenn Sie eine verwenden, aber vorherige Adressen funktionieren weiterhin",
|
||||
"wallet_name_exists": "Wallet mit diesem Namen existiert bereits",
|
||||
|
|
|
@ -532,6 +532,7 @@
|
|||
"search": "Search",
|
||||
"search_language": "Search language",
|
||||
"search_currency": "Search currency",
|
||||
"search_country": "Search country",
|
||||
"new_template" : "New Template",
|
||||
"electrum_address_disclaimer": "We generate new addresses each time you use one, but previous addresses continue to work",
|
||||
"wallet_name_exists": "Wallet with that name has already existed",
|
||||
|
|
|
@ -532,6 +532,7 @@
|
|||
"search": "Búsqueda",
|
||||
"search_language": "Idioma de búsqueda",
|
||||
"search_currency": "Moneda de búsqueda",
|
||||
"search_country": "Buscar país",
|
||||
"new_template" : "Nueva plantilla",
|
||||
"electrum_address_disclaimer": "Generamos nuevas direcciones cada vez que usa una, pero las direcciones anteriores siguen funcionando",
|
||||
"wallet_name_exists": "Wallet con ese nombre ya ha existido",
|
||||
|
|
|
@ -530,6 +530,7 @@
|
|||
"search": "Chercher",
|
||||
"search_language": "Langue de recherche",
|
||||
"search_currency": "Devise de recherche",
|
||||
"search_country": "Pays de recherche",
|
||||
"new_template" : "Nouveau Modèle",
|
||||
"electrum_address_disclaimer": "Nous générons de nouvelles adresses à chaque fois que vous en utilisez une, mais les adresses précédentes continuent à fonctionner",
|
||||
"wallet_name_exists": "Le portefeuille portant ce nom existe déjà",
|
||||
|
|
|
@ -532,6 +532,7 @@
|
|||
"search": "खोज",
|
||||
"search_language": "भाषा खोजें",
|
||||
"search_currency": "मुद्रा खोजें",
|
||||
"search_country": "देश खोजें",
|
||||
"new_template" : "नया टेम्पलेट",
|
||||
"electrum_address_disclaimer": "हर बार जब आप एक का उपयोग करते हैं तो हम नए पते उत्पन्न करते हैं, लेकिन पिछले पते काम करना जारी रखते हैं",
|
||||
"wallet_name_exists": "उस नाम वाला वॉलेट पहले से मौजूद है",
|
||||
|
|
|
@ -532,6 +532,7 @@
|
|||
"search": "Traži",
|
||||
"search_language": "Jezik pretraživanja",
|
||||
"search_currency": "Traži valutu",
|
||||
"search_country": "Traži državu",
|
||||
"new_template" : "novi predložak",
|
||||
"electrum_address_disclaimer": "Minden egyes alkalommal új címeket generálunk, de a korábbi címek továbbra is működnek",
|
||||
"wallet_name_exists": "Novčanik s tim nazivom već postoji",
|
||||
|
|
|
@ -532,6 +532,7 @@
|
|||
"search": "Ricerca",
|
||||
"search_language": "Cerca lingua",
|
||||
"search_currency": "Cerca valuta",
|
||||
"search_country": "Cerca paese",
|
||||
"new_template" : "Nuovo modello",
|
||||
"electrum_address_disclaimer": "Generiamo nuovi indirizzi ogni volta che ne utilizzi uno, ma gli indirizzi precedenti continuano a funzionare",
|
||||
"wallet_name_exists": "Il portafoglio con quel nome è già esistito",
|
||||
|
|
|
@ -532,6 +532,7 @@
|
|||
"search": "検索",
|
||||
"search_language": "検索言語",
|
||||
"search_currency": "検索通貨",
|
||||
"search_country": "国を検索",
|
||||
"new_template" : "新しいテンプレート",
|
||||
"electrum_address_disclaimer": "使用するたびに新しいアドレスが生成されますが、以前のアドレスは引き続き機能します",
|
||||
"wallet_name_exists": "その名前のウォレットはすでに存在しています",
|
||||
|
|
|
@ -532,6 +532,7 @@
|
|||
"search": "찾다",
|
||||
"search_language": "검색 언어",
|
||||
"search_currency": "통화 검색",
|
||||
"search_country": "국가 검색",
|
||||
"new_template" : "새 템플릿",
|
||||
"electrum_address_disclaimer": "사용할 때마다 새 주소가 생성되지만 이전 주소는 계속 작동합니다.",
|
||||
"wallet_name_exists": "해당 이름의 지갑이 이미 존재합니다.",
|
||||
|
|
|
@ -532,6 +532,7 @@
|
|||
"search": "Zoekopdracht",
|
||||
"search_language": "Zoektaal",
|
||||
"search_currency": "Zoek valuta",
|
||||
"search_country": "Land zoeken",
|
||||
"new_template" : "Nieuwe sjabloon",
|
||||
"electrum_address_disclaimer": "We generate new addresses each time you use one, but previous addresses continue to work",
|
||||
"wallet_name_exists": "Portemonnee met die naam bestaat al",
|
||||
|
|
|
@ -532,6 +532,7 @@
|
|||
"search": "Szukaj",
|
||||
"search_language": "Wyszukaj język",
|
||||
"search_currency": "Wyszukaj walutę",
|
||||
"search_country": "Wyszukaj kraj",
|
||||
"new_template" : "Nowy szablon",
|
||||
"electrum_address_disclaimer": "Za każdym razem, gdy korzystasz z jednego z nich, generujemy nowe adresy, ale poprzednie adresy nadal działają",
|
||||
"wallet_name_exists": "Portfel o tej nazwie już istnieje",
|
||||
|
|
|
@ -532,6 +532,7 @@
|
|||
"search": "Procurar",
|
||||
"search_language": "Idioma de pesquisa",
|
||||
"search_currency": "Pesquisar moeda",
|
||||
"search_country": "Pesquisar país",
|
||||
"new_template" : "Novo modelo",
|
||||
"electrum_address_disclaimer": "Geramos novos endereços cada vez que você usa um, mas os endereços anteriores continuam funcionando",
|
||||
"wallet_name_exists": "A carteira com esse nome já existe",
|
||||
|
|
|
@ -532,6 +532,7 @@
|
|||
"search": "Поиск",
|
||||
"search_language": "Язык поиска",
|
||||
"search_currency": "Валюта поиска",
|
||||
"search_country": "Страна поиска",
|
||||
"new_template" : "Новый шаблон",
|
||||
"electrum_address_disclaimer": "Мы генерируем новые адреса каждый раз, когда вы их используете, но предыдущие адреса продолжают работать.",
|
||||
"wallet_name_exists": "Кошелек с таким именем уже существует",
|
||||
|
|
|
@ -531,6 +531,7 @@
|
|||
"search": "Пошук",
|
||||
"search_language": "Мова пошуку",
|
||||
"search_currency": "Шукати валюту",
|
||||
"search_country": "Країна пошуку",
|
||||
"new_template" : "Новий шаблон",
|
||||
"electrum_address_disclaimer": "Ми створюємо нові адреси щоразу, коли ви використовуєте їх, але попередні адреси продовжують працювати",
|
||||
"wallet_name_exists": "Гаманець з такою назвою вже існує",
|
||||
|
|
|
@ -530,6 +530,7 @@
|
|||
"search": "搜索",
|
||||
"search_language": "搜索语言",
|
||||
"search_currency": "搜索货币",
|
||||
"search_country": "搜索国家",
|
||||
"new_template" : "新模板",
|
||||
"electrum_address_disclaimer": "每次您使用一个地址时,我们都会生成新地址,但之前的地址仍然有效",
|
||||
"wallet_name_exists": "同名的钱包已经存在",
|
||||
|
|
Loading…
Reference in a new issue