1.3.0
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
import 'package:country_code_picker/country_codes.dart';
|
||||
import 'package:country_code_picker/country_localizations.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
mixin ToAlias {}
|
||||
|
||||
@deprecated
|
||||
@@ -9,20 +13,53 @@ class CountryCode {
|
||||
String name;
|
||||
|
||||
/// the flag of the country
|
||||
String flagUri;
|
||||
final String flagUri;
|
||||
|
||||
/// the country code (IT,AF..)
|
||||
String code;
|
||||
final String code;
|
||||
|
||||
/// the dial code (+39,+93..)
|
||||
String dialCode;
|
||||
final String dialCode;
|
||||
|
||||
CountryCode({this.name, this.flagUri, this.code, this.dialCode});
|
||||
CountryCode({
|
||||
this.name,
|
||||
this.flagUri,
|
||||
this.code,
|
||||
this.dialCode,
|
||||
});
|
||||
|
||||
factory CountryCode.fromCode(String isoCode) {
|
||||
final Map<String, String> jsonCode = codes.firstWhere(
|
||||
(code) => code['code'] == isoCode,
|
||||
orElse: () => null,
|
||||
);
|
||||
|
||||
if (jsonCode == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return CountryCode.fromJson(jsonCode);
|
||||
}
|
||||
|
||||
factory CountryCode.fromJson(Map<String, dynamic> json) {
|
||||
return CountryCode(
|
||||
name: json['name'],
|
||||
code: json['code'],
|
||||
dialCode: json['dial_code'],
|
||||
flagUri: 'flags/${json['code'].toLowerCase()}.png',
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() => "$dialCode";
|
||||
|
||||
String toLongString() => "$dialCode $name";
|
||||
String toLongString([BuildContext context]) =>
|
||||
"$dialCode ${toCountryStringOnly(context)}";
|
||||
|
||||
String toCountryStringOnly() => '$name';
|
||||
String toCountryStringOnly([BuildContext context]) {
|
||||
if (context != null) {
|
||||
return CountryLocalizations.of(context)?.translate(code) ?? name;
|
||||
}
|
||||
return '$name';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ export 'country_code.dart';
|
||||
|
||||
class CountryCodePicker extends StatefulWidget {
|
||||
final ValueChanged<CountryCode> onChanged;
|
||||
//Exposed new method to get the initial information of the country
|
||||
final ValueChanged<CountryCode> onInit;
|
||||
final String initialSelection;
|
||||
final List<String> favorite;
|
||||
@@ -27,8 +26,8 @@ class CountryCodePicker extends StatefulWidget {
|
||||
/// aligns the flag and the Text left
|
||||
///
|
||||
/// additionally this option also fills the available space of the widget.
|
||||
/// this is especially usefull in combination with [showOnlyCountryWhenClosed],
|
||||
/// because longer countrynames are displayed in one line
|
||||
/// this is especially useful in combination with [showOnlyCountryWhenClosed],
|
||||
/// because longer country names are displayed in one line
|
||||
final bool alignLeft;
|
||||
|
||||
/// shows the flag
|
||||
@@ -59,22 +58,14 @@ class CountryCodePicker extends StatefulWidget {
|
||||
State<StatefulWidget> createState() {
|
||||
List<Map> jsonList = codes;
|
||||
|
||||
List<CountryCode> elements = jsonList
|
||||
.map((s) => CountryCode(
|
||||
name: s['name'],
|
||||
code: s['code'],
|
||||
dialCode: s['dial_code'],
|
||||
flagUri: 'flags/${s['code'].toLowerCase()}.png',
|
||||
))
|
||||
.toList();
|
||||
List<CountryCode> elements =
|
||||
jsonList.map((json) => CountryCode.fromJson(json)).toList();
|
||||
|
||||
if(countryFilter.length > 0) {
|
||||
elements = elements
|
||||
.where((c) => countryFilter.contains(c.code))
|
||||
.toList();
|
||||
if (countryFilter.length > 0) {
|
||||
elements = elements.where((c) => countryFilter.contains(c.code)).toList();
|
||||
}
|
||||
|
||||
return new _CountryCodePickerState(elements);
|
||||
return _CountryCodePickerState(elements);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +112,7 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
|
||||
fit: widget.alignLeft ? FlexFit.tight : FlexFit.loose,
|
||||
child: Text(
|
||||
widget.showOnlyCountryWhenClosed
|
||||
? selectedItem.toCountryStringOnly()
|
||||
? selectedItem.toCountryStringOnly(context)
|
||||
: selectedItem.toString(),
|
||||
style: widget.textStyle ?? Theme.of(context).textTheme.button,
|
||||
),
|
||||
@@ -132,15 +123,16 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
|
||||
}
|
||||
return _widget;
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
void didUpdateWidget(CountryCodePicker oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if(oldWidget.initialSelection != widget.initialSelection) {
|
||||
if (oldWidget.initialSelection != widget.initialSelection) {
|
||||
if (widget.initialSelection != null) {
|
||||
selectedItem = elements.firstWhere(
|
||||
(e) =>
|
||||
(e.code.toUpperCase() == widget.initialSelection.toUpperCase()) ||
|
||||
(e) =>
|
||||
(e.code.toUpperCase() ==
|
||||
widget.initialSelection.toUpperCase()) ||
|
||||
(e.dialCode == widget.initialSelection.toString()),
|
||||
orElse: () => elements[0]);
|
||||
} else {
|
||||
@@ -177,12 +169,15 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
|
||||
void _showSelectionDialog() {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => SelectionDialog(elements, favoriteElements,
|
||||
showCountryOnly: widget.showCountryOnly,
|
||||
emptySearchBuilder: widget.emptySearchBuilder,
|
||||
searchDecoration: widget.searchDecoration,
|
||||
searchStyle: widget.searchStyle,
|
||||
showFlag: widget.showFlag),
|
||||
builder: (_) => SelectionDialog(
|
||||
elements,
|
||||
favoriteElements,
|
||||
showCountryOnly: widget.showCountryOnly,
|
||||
emptySearchBuilder: widget.emptySearchBuilder,
|
||||
searchDecoration: widget.searchDecoration,
|
||||
searchStyle: widget.searchStyle,
|
||||
showFlag: widget.showFlag,
|
||||
),
|
||||
).then((e) {
|
||||
if (e != null) {
|
||||
setState(() {
|
||||
@@ -200,8 +195,8 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
|
||||
}
|
||||
}
|
||||
|
||||
void _onInit(CountryCode initialData){
|
||||
if(widget.onInit != null){
|
||||
void _onInit(CountryCode initialData) {
|
||||
if (widget.onInit != null) {
|
||||
widget.onInit(initialData);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
63
lib/country_localizations.dart
Normal file
63
lib/country_localizations.dart
Normal file
@@ -0,0 +1,63 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class CountryLocalizations {
|
||||
final Locale locale;
|
||||
|
||||
CountryLocalizations(this.locale);
|
||||
|
||||
static CountryLocalizations of(BuildContext context) {
|
||||
return Localizations.of<CountryLocalizations>(
|
||||
context,
|
||||
CountryLocalizations,
|
||||
);
|
||||
}
|
||||
|
||||
static const LocalizationsDelegate<CountryLocalizations> delegate =
|
||||
_CountryLocalizationsDelegate();
|
||||
|
||||
Map<String, String> _localizedStrings;
|
||||
|
||||
Future<bool> load() async {
|
||||
print('locale.languageCode: ${locale.languageCode}');
|
||||
String jsonString = await rootBundle.loadString(
|
||||
'packages/country_code_picker/i18n/${locale.languageCode}.json');
|
||||
Map<String, dynamic> jsonMap = json.decode(jsonString);
|
||||
|
||||
_localizedStrings = jsonMap.map((key, value) {
|
||||
return MapEntry(key, value.toString());
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
String translate(String key) {
|
||||
return _localizedStrings[key];
|
||||
}
|
||||
}
|
||||
|
||||
class _CountryLocalizationsDelegate
|
||||
extends LocalizationsDelegate<CountryLocalizations> {
|
||||
const _CountryLocalizationsDelegate();
|
||||
|
||||
@override
|
||||
bool isSupported(Locale locale) {
|
||||
return [
|
||||
'en',
|
||||
'it',
|
||||
'fr',
|
||||
].contains(locale.languageCode);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<CountryLocalizations> load(Locale locale) async {
|
||||
CountryLocalizations localizations = new CountryLocalizations(locale);
|
||||
await localizations.load();
|
||||
return localizations;
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldReload(_CountryLocalizationsDelegate old) => false;
|
||||
}
|
||||
252
lib/i18n/en.json
Normal file
252
lib/i18n/en.json
Normal file
@@ -0,0 +1,252 @@
|
||||
{
|
||||
"BD": "Bangladesh",
|
||||
"BE": "Belgium",
|
||||
"BF": "Burkina Faso",
|
||||
"BG": "Bulgaria",
|
||||
"BA": "Bosnia and Herzegovina",
|
||||
"BB": "Barbados",
|
||||
"WF": "Wallis and Futuna",
|
||||
"BL": "Saint Barthelemy",
|
||||
"BM": "Bermuda",
|
||||
"BN": "Brunei",
|
||||
"BO": "Bolivia",
|
||||
"BH": "Bahrain",
|
||||
"BI": "Burundi",
|
||||
"BJ": "Benin",
|
||||
"BT": "Bhutan",
|
||||
"JM": "Jamaica",
|
||||
"BV": "Bouvet Island",
|
||||
"BW": "Botswana",
|
||||
"WS": "Samoa",
|
||||
"BQ": "Bonaire, Saint Eustatius and Saba ",
|
||||
"BR": "Brazil",
|
||||
"BS": "Bahamas",
|
||||
"JE": "Jersey",
|
||||
"BY": "Belarus",
|
||||
"BZ": "Belize",
|
||||
"RU": "Russia",
|
||||
"RW": "Rwanda",
|
||||
"RS": "Serbia",
|
||||
"TL": "East Timor",
|
||||
"RE": "Reunion",
|
||||
"TM": "Turkmenistan",
|
||||
"TJ": "Tajikistan",
|
||||
"RO": "Romania",
|
||||
"TK": "Tokelau",
|
||||
"GW": "Guinea-Bissau",
|
||||
"GU": "Guam",
|
||||
"GT": "Guatemala",
|
||||
"GS": "South Georgia and the South Sandwich Islands",
|
||||
"GR": "Greece",
|
||||
"GQ": "Equatorial Guinea",
|
||||
"GP": "Guadeloupe",
|
||||
"JP": "Japan",
|
||||
"GY": "Guyana",
|
||||
"GG": "Guernsey",
|
||||
"GF": "French Guiana",
|
||||
"GE": "Georgia",
|
||||
"GD": "Grenada",
|
||||
"GB": "United Kingdom",
|
||||
"GA": "Gabon",
|
||||
"SV": "El Salvador",
|
||||
"GN": "Guinea",
|
||||
"GM": "Gambia",
|
||||
"GL": "Greenland",
|
||||
"GI": "Gibraltar",
|
||||
"GH": "Ghana",
|
||||
"OM": "Oman",
|
||||
"TN": "Tunisia",
|
||||
"JO": "Jordan",
|
||||
"HR": "Croatia",
|
||||
"HT": "Haiti",
|
||||
"HU": "Hungary",
|
||||
"HK": "Hong Kong",
|
||||
"HN": "Honduras",
|
||||
"HM": "Heard Island and McDonald Islands",
|
||||
"VE": "Venezuela",
|
||||
"PR": "Puerto Rico",
|
||||
"PS": "Palestinian Territory",
|
||||
"PW": "Palau",
|
||||
"PT": "Portugal",
|
||||
"SJ": "Svalbard and Jan Mayen",
|
||||
"PY": "Paraguay",
|
||||
"IQ": "Iraq",
|
||||
"PA": "Panama",
|
||||
"PF": "French Polynesia",
|
||||
"PG": "Papua New Guinea",
|
||||
"PE": "Peru",
|
||||
"PK": "Pakistan",
|
||||
"PH": "Philippines",
|
||||
"PN": "Pitcairn",
|
||||
"PL": "Poland",
|
||||
"PM": "Saint Pierre and Miquelon",
|
||||
"ZM": "Zambia",
|
||||
"EH": "Western Sahara",
|
||||
"EE": "Estonia",
|
||||
"EG": "Egypt",
|
||||
"ZA": "South Africa",
|
||||
"EC": "Ecuador",
|
||||
"IT": "Italy",
|
||||
"VN": "Vietnam",
|
||||
"SB": "Solomon Islands",
|
||||
"ET": "Ethiopia",
|
||||
"SO": "Somalia",
|
||||
"ZW": "Zimbabwe",
|
||||
"SA": "Saudi Arabia",
|
||||
"ES": "Spain",
|
||||
"ER": "Eritrea",
|
||||
"ME": "Montenegro",
|
||||
"MD": "Moldova",
|
||||
"MG": "Madagascar",
|
||||
"MF": "Saint Martin",
|
||||
"MA": "Morocco",
|
||||
"MC": "Monaco",
|
||||
"UZ": "Uzbekistan",
|
||||
"MM": "Myanmar",
|
||||
"ML": "Mali",
|
||||
"MO": "Macao",
|
||||
"MN": "Mongolia",
|
||||
"MH": "Marshall Islands",
|
||||
"MK": "Macedonia",
|
||||
"MU": "Mauritius",
|
||||
"MT": "Malta",
|
||||
"MW": "Malawi",
|
||||
"MV": "Maldives",
|
||||
"MQ": "Martinique",
|
||||
"MP": "Northern Mariana Islands",
|
||||
"MS": "Montserrat",
|
||||
"MR": "Mauritania",
|
||||
"IM": "Isle of Man",
|
||||
"UG": "Uganda",
|
||||
"TZ": "Tanzania",
|
||||
"MY": "Malaysia",
|
||||
"MX": "Mexico",
|
||||
"IL": "Israel",
|
||||
"FR": "France",
|
||||
"IO": "British Indian Ocean Territory",
|
||||
"SH": "Saint Helena",
|
||||
"FI": "Finland",
|
||||
"FJ": "Fiji",
|
||||
"FK": "Falkland Islands",
|
||||
"FM": "Micronesia",
|
||||
"FO": "Faroe Islands",
|
||||
"NI": "Nicaragua",
|
||||
"NL": "Netherlands",
|
||||
"NO": "Norway",
|
||||
"NA": "Namibia",
|
||||
"VU": "Vanuatu",
|
||||
"NC": "New Caledonia",
|
||||
"NE": "Niger",
|
||||
"NF": "Norfolk Island",
|
||||
"NG": "Nigeria",
|
||||
"NZ": "New Zealand",
|
||||
"NP": "Nepal",
|
||||
"NR": "Nauru",
|
||||
"NU": "Niue",
|
||||
"CK": "Cook Islands",
|
||||
"XK": "Kosovo",
|
||||
"CI": "Ivory Coast",
|
||||
"CH": "Switzerland",
|
||||
"CO": "Colombia",
|
||||
"CN": "China",
|
||||
"CM": "Cameroon",
|
||||
"CL": "Chile",
|
||||
"CC": "Cocos Islands",
|
||||
"CA": "Canada",
|
||||
"CG": "Republic of the Congo",
|
||||
"CF": "Central African Republic",
|
||||
"CD": "Democratic Republic of the Congo",
|
||||
"CZ": "Czech Republic",
|
||||
"CY": "Cyprus",
|
||||
"CX": "Christmas Island",
|
||||
"CR": "Costa Rica",
|
||||
"CW": "Curacao",
|
||||
"CV": "Cape Verde",
|
||||
"CU": "Cuba",
|
||||
"SZ": "Swaziland",
|
||||
"SY": "Syria",
|
||||
"SX": "Sint Maarten",
|
||||
"KG": "Kyrgyzstan",
|
||||
"KE": "Kenya",
|
||||
"SS": "South Sudan",
|
||||
"SR": "Suriname",
|
||||
"KI": "Kiribati",
|
||||
"KH": "Cambodia",
|
||||
"KN": "Saint Kitts and Nevis",
|
||||
"KM": "Comoros",
|
||||
"ST": "Sao Tome and Principe",
|
||||
"SK": "Slovakia",
|
||||
"KR": "South Korea",
|
||||
"SI": "Slovenia",
|
||||
"KP": "North Korea",
|
||||
"KW": "Kuwait",
|
||||
"SN": "Senegal",
|
||||
"SM": "San Marino",
|
||||
"SL": "Sierra Leone",
|
||||
"SC": "Seychelles",
|
||||
"KZ": "Kazakhstan",
|
||||
"KY": "Cayman Islands",
|
||||
"SG": "Singapore",
|
||||
"SE": "Sweden",
|
||||
"SD": "Sudan",
|
||||
"DO": "Dominican Republic",
|
||||
"DM": "Dominica",
|
||||
"DJ": "Djibouti",
|
||||
"DK": "Denmark",
|
||||
"VG": "British Virgin Islands",
|
||||
"DE": "Germany",
|
||||
"YE": "Yemen",
|
||||
"DZ": "Algeria",
|
||||
"US": "United States",
|
||||
"UY": "Uruguay",
|
||||
"YT": "Mayotte",
|
||||
"UM": "United States Minor Outlying Islands",
|
||||
"LB": "Lebanon",
|
||||
"LC": "Saint Lucia",
|
||||
"LA": "Laos",
|
||||
"TV": "Tuvalu",
|
||||
"TW": "Taiwan",
|
||||
"TT": "Trinidad and Tobago",
|
||||
"TR": "Turkey",
|
||||
"LK": "Sri Lanka",
|
||||
"LI": "Liechtenstein",
|
||||
"LV": "Latvia",
|
||||
"TO": "Tonga",
|
||||
"LT": "Lithuania",
|
||||
"LU": "Luxembourg",
|
||||
"LR": "Liberia",
|
||||
"LS": "Lesotho",
|
||||
"TH": "Thailand",
|
||||
"TF": "French Southern Territories",
|
||||
"TG": "Togo",
|
||||
"TD": "Chad",
|
||||
"TC": "Turks and Caicos Islands",
|
||||
"LY": "Libya",
|
||||
"VA": "Vatican",
|
||||
"VC": "Saint Vincent and the Grenadines",
|
||||
"AE": "United Arab Emirates",
|
||||
"AD": "Andorra",
|
||||
"AG": "Antigua and Barbuda",
|
||||
"AF": "Afghanistan",
|
||||
"AI": "Anguilla",
|
||||
"VI": "U.S. Virgin Islands",
|
||||
"IS": "Iceland",
|
||||
"IR": "Iran",
|
||||
"AM": "Armenia",
|
||||
"AL": "Albania",
|
||||
"AO": "Angola",
|
||||
"AQ": "Antarctica",
|
||||
"AS": "American Samoa",
|
||||
"AR": "Argentina",
|
||||
"AU": "Australia",
|
||||
"AT": "Austria",
|
||||
"AW": "Aruba",
|
||||
"IN": "India",
|
||||
"AX": "Aland Islands",
|
||||
"AZ": "Azerbaijan",
|
||||
"IE": "Ireland",
|
||||
"ID": "Indonesia",
|
||||
"UA": "Ukraine",
|
||||
"QA": "Qatar",
|
||||
"MZ": "Mozambique"
|
||||
}
|
||||
257
lib/i18n/fr.json
Normal file
257
lib/i18n/fr.json
Normal file
@@ -0,0 +1,257 @@
|
||||
{
|
||||
"AF": "Afghanistan",
|
||||
"ZA": "Afrique du Sud",
|
||||
"AL": "Albanie",
|
||||
"DZ": "Algérie",
|
||||
"DE": "Allemagne",
|
||||
"AD": "Andorre",
|
||||
"AO": "Angola",
|
||||
"AI": "Anguilla",
|
||||
"AQ": "Antarctique",
|
||||
"AG": "Antigua-et-Barbuda",
|
||||
"SA": "Arabie saoudite",
|
||||
"AR": "Argentine",
|
||||
"AM": "Arménie",
|
||||
"AW": "Aruba",
|
||||
"AU": "Australie",
|
||||
"AT": "Autriche",
|
||||
"AZ": "Azerbaïdjan",
|
||||
"BS": "Bahamas",
|
||||
"BH": "Bahreïn",
|
||||
"BD": "Bangladesh",
|
||||
"BB": "Barbade",
|
||||
"BE": "Belgique",
|
||||
"BZ": "Belize",
|
||||
"BJ": "Bénin",
|
||||
"BM": "Bermudes",
|
||||
"BT": "Bhoutan",
|
||||
"BY": "Biélorussie",
|
||||
"BO": "Bolivie",
|
||||
"BA": "Bosnie-Herzégovine",
|
||||
"BW": "Botswana",
|
||||
"BR": "Brésil",
|
||||
"BN": "Brunéi Darussalam",
|
||||
"BG": "Bulgarie",
|
||||
"BF": "Burkina Faso",
|
||||
"BI": "Burundi",
|
||||
"KH": "Cambodge",
|
||||
"CM": "Cameroun",
|
||||
"CA": "Canada",
|
||||
"CV": "Cap-Vert",
|
||||
"EA": "Ceuta et Melilla",
|
||||
"CL": "Chili",
|
||||
"CN": "Chine",
|
||||
"CY": "Chypre",
|
||||
"CO": "Colombie",
|
||||
"KM": "Comores",
|
||||
"CG": "Congo-Brazzaville",
|
||||
"CD": "Congo-Kinshasa",
|
||||
"KP": "Corée du Nord",
|
||||
"KR": "Corée du Sud",
|
||||
"CR": "Costa Rica",
|
||||
"CI": "Côte d’Ivoire",
|
||||
"HR": "Croatie",
|
||||
"CU": "Cuba",
|
||||
"CW": "Curaçao",
|
||||
"DK": "Danemark",
|
||||
"DG": "Diego Garcia",
|
||||
"DJ": "Djibouti",
|
||||
"DM": "Dominique",
|
||||
"EG": "Égypte",
|
||||
"AE": "Émirats arabes unis",
|
||||
"EC": "Équateur",
|
||||
"ER": "Érythrée",
|
||||
"ES": "Espagne",
|
||||
"EE": "Estonie",
|
||||
"SZ": "Eswatini",
|
||||
"VA": "État de la Cité du Vatican",
|
||||
"FM": "États fédérés de Micronésie",
|
||||
"US": "États-Unis",
|
||||
"ET": "Éthiopie",
|
||||
"FJ": "Fidji",
|
||||
"FI": "Finlande",
|
||||
"FR": "France",
|
||||
"GA": "Gabon",
|
||||
"GM": "Gambie",
|
||||
"GE": "Géorgie",
|
||||
"GS": "Géorgie du Sud et îles Sandwich du Sud",
|
||||
"GH": "Ghana",
|
||||
"GI": "Gibraltar",
|
||||
"GR": "Grèce",
|
||||
"GD": "Grenade",
|
||||
"GL": "Groenland",
|
||||
"GP": "Guadeloupe",
|
||||
"GU": "Guam",
|
||||
"GT": "Guatemala",
|
||||
"GG": "Guernesey",
|
||||
"GN": "Guinée",
|
||||
"GQ": "Guinée équatoriale",
|
||||
"GW": "Guinée-Bissau",
|
||||
"GY": "Guyana",
|
||||
"GF": "Guyane française",
|
||||
"HT": "Haïti",
|
||||
"HN": "Honduras",
|
||||
"HU": "Hongrie",
|
||||
"CX": "Île Christmas",
|
||||
"AC": "Île de l’Ascension",
|
||||
"IM": "Île de Man",
|
||||
"NF": "Île Norfolk",
|
||||
"AX": "Îles Åland",
|
||||
"KY": "Îles Caïmans",
|
||||
"IC": "Îles Canaries",
|
||||
"CC": "Îles Cocos",
|
||||
"CK": "Îles Cook",
|
||||
"FO": "Îles Féroé",
|
||||
"FK": "Îles Malouines",
|
||||
"MP": "Îles Mariannes du Nord",
|
||||
"MH": "Îles Marshall",
|
||||
"UM": "Îles mineures éloignées des États-Unis",
|
||||
"PN": "Îles Pitcairn",
|
||||
"SB": "Îles Salomon",
|
||||
"TC": "Îles Turques-et-Caïques",
|
||||
"VG": "Îles Vierges britanniques",
|
||||
"VI": "Îles Vierges des États-Unis",
|
||||
"IN": "Inde",
|
||||
"ID": "Indonésie",
|
||||
"IQ": "Irak",
|
||||
"IR": "Iran",
|
||||
"IE": "Irlande",
|
||||
"IS": "Islande",
|
||||
"IL": "Israël",
|
||||
"IT": "Italie",
|
||||
"JM": "Jamaïque",
|
||||
"JP": "Japon",
|
||||
"JE": "Jersey",
|
||||
"JO": "Jordanie",
|
||||
"KZ": "Kazakhstan",
|
||||
"KE": "Kenya",
|
||||
"KG": "Kirghizistan",
|
||||
"KI": "Kiribati",
|
||||
"XK": "Kosovo",
|
||||
"KW": "Koweït",
|
||||
"RE": "La Réunion",
|
||||
"LA": "Laos",
|
||||
"LS": "Lesotho",
|
||||
"LV": "Lettonie",
|
||||
"LB": "Liban",
|
||||
"LR": "Libéria",
|
||||
"LY": "Libye",
|
||||
"LI": "Liechtenstein",
|
||||
"LT": "Lituanie",
|
||||
"LU": "Luxembourg",
|
||||
"MK": "Macédoine",
|
||||
"MG": "Madagascar",
|
||||
"MY": "Malaisie",
|
||||
"MW": "Malawi",
|
||||
"MV": "Maldives",
|
||||
"ML": "Mali",
|
||||
"MT": "Malte",
|
||||
"MA": "Maroc",
|
||||
"MQ": "Martinique",
|
||||
"MU": "Maurice",
|
||||
"MR": "Mauritanie",
|
||||
"YT": "Mayotte",
|
||||
"MX": "Mexique",
|
||||
"MD": "Moldavie",
|
||||
"MC": "Monaco",
|
||||
"MN": "Mongolie",
|
||||
"ME": "Monténégro",
|
||||
"MS": "Montserrat",
|
||||
"MZ": "Mozambique",
|
||||
"MM": "Myanmar (Birmanie)",
|
||||
"NA": "Namibie",
|
||||
"NR": "Nauru",
|
||||
"NP": "Népal",
|
||||
"NI": "Nicaragua",
|
||||
"NE": "Niger",
|
||||
"NG": "Nigéria",
|
||||
"NU": "Niue",
|
||||
"NO": "Norvège",
|
||||
"NC": "Nouvelle-Calédonie",
|
||||
"NZ": "Nouvelle-Zélande",
|
||||
"OM": "Oman",
|
||||
"UG": "Ouganda",
|
||||
"UZ": "Ouzbékistan",
|
||||
"PK": "Pakistan",
|
||||
"PW": "Palaos",
|
||||
"PA": "Panama",
|
||||
"PG": "Papouasie-Nouvelle-Guinée",
|
||||
"PY": "Paraguay",
|
||||
"NL": "Pays-Bas",
|
||||
"BQ": "Pays-Bas caribéens",
|
||||
"PE": "Pérou",
|
||||
"PH": "Philippines",
|
||||
"PL": "Pologne",
|
||||
"PF": "Polynésie française",
|
||||
"PR": "Porto Rico",
|
||||
"PT": "Portugal",
|
||||
"XA": "pseudo-accents",
|
||||
"XB": "pseudo-bidi",
|
||||
"QA": "Qatar",
|
||||
"HK": "R.A.S. chinoise de Hong Kong",
|
||||
"MO": "R.A.S. chinoise de Macao",
|
||||
"CF": "République centrafricaine",
|
||||
"DO": "République dominicaine",
|
||||
"RO": "Roumanie",
|
||||
"GB": "Royaume-Uni",
|
||||
"RU": "Russie",
|
||||
"RW": "Rwanda",
|
||||
"EH": "Sahara occidental",
|
||||
"BL": "Saint-Barthélemy",
|
||||
"KN": "Saint-Christophe-et-Niévès",
|
||||
"SM": "Saint-Marin",
|
||||
"MF": "Saint-Martin",
|
||||
"SX": "Saint-Martin (partie néerlandaise)",
|
||||
"PM": "Saint-Pierre-et-Miquelon",
|
||||
"VC": "Saint-Vincent-et-les-Grenadines",
|
||||
"SH": "Sainte-Hélène",
|
||||
"LC": "Sainte-Lucie",
|
||||
"SV": "Salvador",
|
||||
"WS": "Samoa",
|
||||
"AS": "Samoa américaines",
|
||||
"ST": "Sao Tomé-et-Principe",
|
||||
"SN": "Sénégal",
|
||||
"RS": "Serbie",
|
||||
"SC": "Seychelles",
|
||||
"SL": "Sierra Leone",
|
||||
"SG": "Singapour",
|
||||
"SK": "Slovaquie",
|
||||
"SI": "Slovénie",
|
||||
"SO": "Somalie",
|
||||
"SD": "Soudan",
|
||||
"SS": "Soudan du Sud",
|
||||
"LK": "Sri Lanka",
|
||||
"SE": "Suède",
|
||||
"CH": "Suisse",
|
||||
"SR": "Suriname",
|
||||
"SJ": "Svalbard et Jan Mayen",
|
||||
"SY": "Syrie",
|
||||
"TJ": "Tadjikistan",
|
||||
"TW": "Taïwan",
|
||||
"TZ": "Tanzanie",
|
||||
"TD": "Tchad",
|
||||
"CZ": "Tchéquie",
|
||||
"TF": "Terres australes françaises",
|
||||
"IO": "Territoire britannique de l’océan Indien",
|
||||
"PS": "Territoires palestiniens",
|
||||
"TH": "Thaïlande",
|
||||
"TL": "Timor oriental",
|
||||
"TG": "Togo",
|
||||
"TK": "Tokelau",
|
||||
"TO": "Tonga",
|
||||
"TT": "Trinité-et-Tobago",
|
||||
"TA": "Tristan da Cunha",
|
||||
"TN": "Tunisie",
|
||||
"TM": "Turkménistan",
|
||||
"TR": "Turquie",
|
||||
"TV": "Tuvalu",
|
||||
"UA": "Ukraine",
|
||||
"UY": "Uruguay",
|
||||
"VU": "Vanuatu",
|
||||
"VE": "Venezuela",
|
||||
"VN": "Vietnam",
|
||||
"WF": "Wallis-et-Futuna",
|
||||
"YE": "Yémen",
|
||||
"ZM": "Zambie",
|
||||
"ZW": "Zimbabwe"
|
||||
}
|
||||
257
lib/i18n/it.json
Normal file
257
lib/i18n/it.json
Normal file
@@ -0,0 +1,257 @@
|
||||
{
|
||||
"AF": "Afghanistan",
|
||||
"AL": "Albania",
|
||||
"DZ": "Algeria",
|
||||
"UM": "Altre isole americane del Pacifico",
|
||||
"AD": "Andorra",
|
||||
"AO": "Angola",
|
||||
"AI": "Anguilla",
|
||||
"AQ": "Antartide",
|
||||
"AG": "Antigua e Barbuda",
|
||||
"SA": "Arabia Saudita",
|
||||
"AR": "Argentina",
|
||||
"AM": "Armenia",
|
||||
"AW": "Aruba",
|
||||
"AU": "Australia",
|
||||
"AT": "Austria",
|
||||
"AZ": "Azerbaigian",
|
||||
"BS": "Bahamas",
|
||||
"BH": "Bahrein",
|
||||
"BD": "Bangladesh",
|
||||
"BB": "Barbados",
|
||||
"BE": "Belgio",
|
||||
"BZ": "Belize",
|
||||
"BJ": "Benin",
|
||||
"BM": "Bermuda",
|
||||
"BT": "Bhutan",
|
||||
"BY": "Bielorussia",
|
||||
"BO": "Bolivia",
|
||||
"BA": "Bosnia ed Erzegovina",
|
||||
"BW": "Botswana",
|
||||
"BR": "Brasile",
|
||||
"BN": "Brunei",
|
||||
"BG": "Bulgaria",
|
||||
"BF": "Burkina Faso",
|
||||
"BI": "Burundi",
|
||||
"KH": "Cambogia",
|
||||
"CM": "Camerun",
|
||||
"CA": "Canada",
|
||||
"CV": "Capo Verde",
|
||||
"BQ": "Caraibi olandesi",
|
||||
"CZ": "Cechia",
|
||||
"EA": "Ceuta e Melilla",
|
||||
"TD": "Ciad",
|
||||
"CL": "Cile",
|
||||
"CN": "Cina",
|
||||
"CY": "Cipro",
|
||||
"VA": "Città del Vaticano",
|
||||
"CO": "Colombia",
|
||||
"KM": "Comore",
|
||||
"CD": "Congo - Kinshasa",
|
||||
"CG": "Congo-Brazzaville",
|
||||
"KP": "Corea del Nord",
|
||||
"KR": "Corea del Sud",
|
||||
"CI": "Costa d’Avorio",
|
||||
"CR": "Costa Rica",
|
||||
"HR": "Croazia",
|
||||
"CU": "Cuba",
|
||||
"CW": "Curaçao",
|
||||
"DK": "Danimarca",
|
||||
"DG": "Diego Garcia",
|
||||
"DM": "Dominica",
|
||||
"EC": "Ecuador",
|
||||
"EG": "Egitto",
|
||||
"SV": "El Salvador",
|
||||
"AE": "Emirati Arabi Uniti",
|
||||
"ER": "Eritrea",
|
||||
"EE": "Estonia",
|
||||
"ET": "Etiopia",
|
||||
"FJ": "Figi",
|
||||
"PH": "Filippine",
|
||||
"FI": "Finlandia",
|
||||
"FR": "Francia",
|
||||
"GA": "Gabon",
|
||||
"GM": "Gambia",
|
||||
"GE": "Georgia",
|
||||
"GS": "Georgia del Sud e Sandwich australi",
|
||||
"DE": "Germania",
|
||||
"GH": "Ghana",
|
||||
"JM": "Giamaica",
|
||||
"JP": "Giappone",
|
||||
"GI": "Gibilterra",
|
||||
"DJ": "Gibuti",
|
||||
"JO": "Giordania",
|
||||
"GR": "Grecia",
|
||||
"GD": "Grenada",
|
||||
"GL": "Groenlandia",
|
||||
"GP": "Guadalupa",
|
||||
"GU": "Guam",
|
||||
"GT": "Guatemala",
|
||||
"GG": "Guernsey",
|
||||
"GN": "Guinea",
|
||||
"GQ": "Guinea Equatoriale",
|
||||
"GW": "Guinea-Bissau",
|
||||
"GY": "Guyana",
|
||||
"GF": "Guyana francese",
|
||||
"HT": "Haiti",
|
||||
"HN": "Honduras",
|
||||
"IN": "India",
|
||||
"ID": "Indonesia",
|
||||
"IR": "Iran",
|
||||
"IQ": "Iraq",
|
||||
"IE": "Irlanda",
|
||||
"IS": "Islanda",
|
||||
"AC": "Isola Ascensione",
|
||||
"CX": "Isola Christmas",
|
||||
"IM": "Isola di Man",
|
||||
"NF": "Isola Norfolk",
|
||||
"AX": "Isole Åland",
|
||||
"IC": "Isole Canarie",
|
||||
"KY": "Isole Cayman",
|
||||
"CC": "Isole Cocos (Keeling)",
|
||||
"CK": "Isole Cook",
|
||||
"FO": "Isole Fær Øer",
|
||||
"FK": "Isole Falkland",
|
||||
"MP": "Isole Marianne settentrionali",
|
||||
"MH": "Isole Marshall",
|
||||
"PN": "Isole Pitcairn",
|
||||
"SB": "Isole Salomone",
|
||||
"TC": "Isole Turks e Caicos",
|
||||
"VI": "Isole Vergini Americane",
|
||||
"VG": "Isole Vergini Britanniche",
|
||||
"IL": "Israele",
|
||||
"IT": "Italia",
|
||||
"JE": "Jersey",
|
||||
"KZ": "Kazakistan",
|
||||
"KE": "Kenya",
|
||||
"KG": "Kirghizistan",
|
||||
"KI": "Kiribati",
|
||||
"XK": "Kosovo",
|
||||
"KW": "Kuwait",
|
||||
"LA": "Laos",
|
||||
"LS": "Lesotho",
|
||||
"LV": "Lettonia",
|
||||
"LB": "Libano",
|
||||
"LR": "Liberia",
|
||||
"LY": "Libia",
|
||||
"LI": "Liechtenstein",
|
||||
"LT": "Lituania",
|
||||
"LU": "Lussemburgo",
|
||||
"MK": "Macedonia del Nord",
|
||||
"MG": "Madagascar",
|
||||
"MW": "Malawi",
|
||||
"MY": "Malaysia",
|
||||
"MV": "Maldive",
|
||||
"ML": "Mali",
|
||||
"MT": "Malta",
|
||||
"MA": "Marocco",
|
||||
"MQ": "Martinica",
|
||||
"MR": "Mauritania",
|
||||
"MU": "Mauritius",
|
||||
"YT": "Mayotte",
|
||||
"MX": "Messico",
|
||||
"FM": "Micronesia",
|
||||
"MD": "Moldavia",
|
||||
"MC": "Monaco",
|
||||
"MN": "Mongolia",
|
||||
"ME": "Montenegro",
|
||||
"MS": "Montserrat",
|
||||
"MZ": "Mozambico",
|
||||
"MM": "Myanmar (Birmania)",
|
||||
"NA": "Namibia",
|
||||
"NR": "Nauru",
|
||||
"NP": "Nepal",
|
||||
"NI": "Nicaragua",
|
||||
"NE": "Niger",
|
||||
"NG": "Nigeria",
|
||||
"NU": "Niue",
|
||||
"NO": "Norvegia",
|
||||
"NC": "Nuova Caledonia",
|
||||
"NZ": "Nuova Zelanda",
|
||||
"OM": "Oman",
|
||||
"NL": "Paesi Bassi",
|
||||
"PK": "Pakistan",
|
||||
"PW": "Palau",
|
||||
"PA": "Panamá",
|
||||
"PG": "Papua Nuova Guinea",
|
||||
"PY": "Paraguay",
|
||||
"PE": "Perù",
|
||||
"PF": "Polinesia francese",
|
||||
"PL": "Polonia",
|
||||
"PT": "Portogallo",
|
||||
"PR": "Portorico",
|
||||
"XA": "pseudo-accenti",
|
||||
"XB": "pseudo-bidi",
|
||||
"QA": "Qatar",
|
||||
"HK": "RAS di Hong Kong",
|
||||
"MO": "RAS di Macao",
|
||||
"GB": "Regno Unito",
|
||||
"CF": "Repubblica Centrafricana",
|
||||
"DO": "Repubblica Dominicana",
|
||||
"RE": "Riunione",
|
||||
"RO": "Romania",
|
||||
"RW": "Ruanda",
|
||||
"RU": "Russia",
|
||||
"EH": "Sahara occidentale",
|
||||
"KN": "Saint Kitts e Nevis",
|
||||
"LC": "Saint Lucia",
|
||||
"MF": "Saint Martin",
|
||||
"VC": "Saint Vincent e Grenadine",
|
||||
"BL": "Saint-Barthélemy",
|
||||
"PM": "Saint-Pierre e Miquelon",
|
||||
"WS": "Samoa",
|
||||
"AS": "Samoa americane",
|
||||
"SM": "San Marino",
|
||||
"SH": "Sant’Elena",
|
||||
"ST": "São Tomé e Príncipe",
|
||||
"SN": "Senegal",
|
||||
"RS": "Serbia",
|
||||
"SC": "Seychelles",
|
||||
"SL": "Sierra Leone",
|
||||
"SG": "Singapore",
|
||||
"SX": "Sint Maarten",
|
||||
"SY": "Siria",
|
||||
"SK": "Slovacchia",
|
||||
"SI": "Slovenia",
|
||||
"SO": "Somalia",
|
||||
"ES": "Spagna",
|
||||
"LK": "Sri Lanka",
|
||||
"US": "Stati Uniti",
|
||||
"SS": "Sud Sudan",
|
||||
"ZA": "Sudafrica",
|
||||
"SD": "Sudan",
|
||||
"SR": "Suriname",
|
||||
"SJ": "Svalbard e Jan Mayen",
|
||||
"SE": "Svezia",
|
||||
"CH": "Svizzera",
|
||||
"SZ": "Swaziland",
|
||||
"TJ": "Tagikistan",
|
||||
"TW": "Taiwan",
|
||||
"TZ": "Tanzania",
|
||||
"TF": "Terre australi francesi",
|
||||
"PS": "Territori palestinesi",
|
||||
"IO": "Territorio britannico dell’Oceano Indiano",
|
||||
"TH": "Thailandia",
|
||||
"TL": "Timor Est",
|
||||
"TG": "Togo",
|
||||
"TK": "Tokelau",
|
||||
"TO": "Tonga",
|
||||
"TT": "Trinidad e Tobago",
|
||||
"TA": "Tristan da Cunha",
|
||||
"TN": "Tunisia",
|
||||
"TR": "Turchia",
|
||||
"TM": "Turkmenistan",
|
||||
"TV": "Tuvalu",
|
||||
"UA": "Ucraina",
|
||||
"UG": "Uganda",
|
||||
"HU": "Ungheria",
|
||||
"UY": "Uruguay",
|
||||
"UZ": "Uzbekistan",
|
||||
"VU": "Vanuatu",
|
||||
"VE": "Venezuela",
|
||||
"VN": "Vietnam",
|
||||
"WF": "Wallis e Futuna",
|
||||
"YE": "Yemen",
|
||||
"ZM": "Zambia",
|
||||
"ZW": "Zimbabwe"
|
||||
}
|
||||
@@ -13,17 +13,17 @@ class SelectionDialog extends StatefulWidget {
|
||||
/// elements passed as favorite
|
||||
final List<CountryCode> favoriteElements;
|
||||
|
||||
SelectionDialog(this.elements, this.favoriteElements, {
|
||||
Key key,
|
||||
this.showCountryOnly,
|
||||
this.emptySearchBuilder,
|
||||
InputDecoration searchDecoration = const InputDecoration(),
|
||||
this.searchStyle,
|
||||
this.showFlag
|
||||
}) :
|
||||
assert(searchDecoration != null, 'searchDecoration must not be null!'),
|
||||
this.searchDecoration = searchDecoration.copyWith(prefixIcon: Icon(Icons.search)),
|
||||
super(key: key);
|
||||
SelectionDialog(this.elements, this.favoriteElements,
|
||||
{Key key,
|
||||
this.showCountryOnly,
|
||||
this.emptySearchBuilder,
|
||||
InputDecoration searchDecoration = const InputDecoration(),
|
||||
this.searchStyle,
|
||||
this.showFlag})
|
||||
: assert(searchDecoration != null, 'searchDecoration must not be null!'),
|
||||
this.searchDecoration =
|
||||
searchDecoration.copyWith(prefixIcon: Icon(Icons.search)),
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _SelectionDialogState();
|
||||
@@ -35,48 +35,51 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => SimpleDialog(
|
||||
title: Column(
|
||||
children: <Widget>[
|
||||
TextField(
|
||||
style: widget.searchStyle,
|
||||
decoration: widget.searchDecoration,
|
||||
onChanged: _filterElements,
|
||||
),
|
||||
],
|
||||
),
|
||||
children: [
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: ListView(
|
||||
children: [
|
||||
widget.favoriteElements.isEmpty
|
||||
? const DecoratedBox(decoration: BoxDecoration())
|
||||
: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[]
|
||||
..addAll(widget.favoriteElements
|
||||
.map(
|
||||
(f) => SimpleDialogOption(
|
||||
child: _buildOption(f),
|
||||
onPressed: () {
|
||||
_selectItem(f);
|
||||
},
|
||||
),
|
||||
)
|
||||
.toList())
|
||||
..add(const Divider())),
|
||||
]..addAll(filteredElements.isEmpty
|
||||
? [_buildEmptySearchWidget(context)]
|
||||
: filteredElements.map(
|
||||
title: Column(
|
||||
children: <Widget>[
|
||||
TextField(
|
||||
style: widget.searchStyle,
|
||||
decoration: widget.searchDecoration,
|
||||
onChanged: _filterElements,
|
||||
),
|
||||
],
|
||||
),
|
||||
children: [
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: MediaQuery.of(context).size.height * 0.7,
|
||||
child: ListView(
|
||||
children: [
|
||||
widget.favoriteElements.isEmpty
|
||||
? const DecoratedBox(decoration: BoxDecoration())
|
||||
: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
...widget.favoriteElements.map(
|
||||
(f) => SimpleDialogOption(
|
||||
child: _buildOption(f),
|
||||
onPressed: () {
|
||||
_selectItem(f);
|
||||
},
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
],
|
||||
),
|
||||
if (filteredElements.isEmpty)
|
||||
_buildEmptySearchWidget(context)
|
||||
else
|
||||
...filteredElements.map(
|
||||
(e) => SimpleDialogOption(
|
||||
key: Key(e.toLongString()),
|
||||
child: _buildOption(e),
|
||||
onPressed: () {
|
||||
_selectItem(e);
|
||||
},
|
||||
)))
|
||||
)
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -87,22 +90,23 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
child: Flex(
|
||||
direction: Axis.horizontal,
|
||||
children: <Widget>[
|
||||
widget.showFlag ? Flexible(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 16.0),
|
||||
child: Image.asset(
|
||||
e.flagUri,
|
||||
package: 'country_code_picker',
|
||||
width: 32.0,
|
||||
if (widget.showFlag)
|
||||
Flexible(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 16.0),
|
||||
child: Image.asset(
|
||||
e.flagUri,
|
||||
package: 'country_code_picker',
|
||||
width: 32.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
) : Container(),
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Text(
|
||||
widget.showCountryOnly
|
||||
? e.toCountryStringOnly()
|
||||
: e.toLongString(),
|
||||
? e.toCountryStringOnly(context)
|
||||
: e.toLongString(context),
|
||||
overflow: TextOverflow.fade,
|
||||
),
|
||||
),
|
||||
@@ -116,7 +120,9 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
return widget.emptySearchBuilder(context);
|
||||
}
|
||||
|
||||
return Center(child: Text('No Country Found'));
|
||||
return Center(
|
||||
child: Text('No country found'),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user