diff --git a/lib/src/screens/cake_phone/cake_phone_products/phone_number_product_page.dart b/lib/src/screens/cake_phone/cake_phone_products/phone_number_product_page.dart index 4389c3bbf..5f9469388 100644 --- a/lib/src/screens/cake_phone/cake_phone_products/phone_number_product_page.dart +++ b/lib/src/screens/cake_phone/cake_phone_products/phone_number_product_page.dart @@ -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 { ), ), ), - 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( + 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, + ), + ], + ), ), ), ], diff --git a/lib/view_model/settings/settings_view_model.dart b/lib/view_model/settings/settings_view_model.dart index d335c8688..9e8044455 100644 --- a/lib/view_model/settings/settings_view_model.dart +++ b/lib/view_model/settings/settings_view_model.dart @@ -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( diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index 911ce0aa0..a4aebc7ad 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -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", diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index d24ac1070..8033af9c6 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -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", diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index b1dd4821c..78e7098fe 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -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", diff --git a/res/values/strings_fr.arb b/res/values/strings_fr.arb index a0530d6be..18541371f 100644 --- a/res/values/strings_fr.arb +++ b/res/values/strings_fr.arb @@ -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à", diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index d83dc97ce..23f1e99de 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -532,6 +532,7 @@ "search": "खोज", "search_language": "भाषा खोजें", "search_currency": "मुद्रा खोजें", + "search_country": "देश खोजें", "new_template" : "नया टेम्पलेट", "electrum_address_disclaimer": "हर बार जब आप एक का उपयोग करते हैं तो हम नए पते उत्पन्न करते हैं, लेकिन पिछले पते काम करना जारी रखते हैं", "wallet_name_exists": "उस नाम वाला वॉलेट पहले से मौजूद है", diff --git a/res/values/strings_hr.arb b/res/values/strings_hr.arb index dd933346a..dd2a6d8b7 100644 --- a/res/values/strings_hr.arb +++ b/res/values/strings_hr.arb @@ -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", diff --git a/res/values/strings_it.arb b/res/values/strings_it.arb index 05d371f75..0d0904751 100644 --- a/res/values/strings_it.arb +++ b/res/values/strings_it.arb @@ -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", diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index 86b36b8e8..c1b69fe29 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -532,6 +532,7 @@ "search": "検索", "search_language": "検索言語", "search_currency": "検索通貨", + "search_country": "国を検索", "new_template" : "新しいテンプレート", "electrum_address_disclaimer": "使用するたびに新しいアドレスが生成されますが、以前のアドレスは引き続き機能します", "wallet_name_exists": "その名前のウォレットはすでに存在しています", diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index 1738ef5a6..b9b8db2b7 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -532,6 +532,7 @@ "search": "찾다", "search_language": "검색 언어", "search_currency": "통화 검색", + "search_country": "국가 검색", "new_template" : "새 템플릿", "electrum_address_disclaimer": "사용할 때마다 새 주소가 생성되지만 이전 주소는 계속 작동합니다.", "wallet_name_exists": "해당 이름의 지갑이 이미 존재합니다.", diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index 752197f8d..d14ddf89a 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -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", diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index db652d302..acb71f7ff 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -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", diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index 06f9b9141..7fbe76351 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -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", diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index ea66698a3..3f7603477 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -532,6 +532,7 @@ "search": "Поиск", "search_language": "Язык поиска", "search_currency": "Валюта поиска", + "search_country": "Страна поиска", "new_template" : "Новый шаблон", "electrum_address_disclaimer": "Мы генерируем новые адреса каждый раз, когда вы их используете, но предыдущие адреса продолжают работать.", "wallet_name_exists": "Кошелек с таким именем уже существует", diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index 1fd691b23..c65cdf14c 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -531,6 +531,7 @@ "search": "Пошук", "search_language": "Мова пошуку", "search_currency": "Шукати валюту", + "search_country": "Країна пошуку", "new_template" : "Новий шаблон", "electrum_address_disclaimer": "Ми створюємо нові адреси щоразу, коли ви використовуєте їх, але попередні адреси продовжують працювати", "wallet_name_exists": "Гаманець з такою назвою вже існує", diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index 1cbd93a7c..0fb744fe3 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -530,6 +530,7 @@ "search": "搜索", "search_language": "搜索语言", "search_currency": "搜索货币", + "search_country": "搜索国家", "new_template" : "新模板", "electrum_address_disclaimer": "每次您使用一个地址时,我们都会生成新地址,但之前的地址仍然有效", "wallet_name_exists": "同名的钱包已经存在",