From 1a18a5f5b6fef9e39dc7e90320418cf770ea7e50 Mon Sep 17 00:00:00 2001 From: yetitechnepal <72850136+yetitechnepal@users.noreply.github.com> Date: Mon, 22 Mar 2021 11:31:49 +0545 Subject: [PATCH 1/3] Fixed Typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit नपल >> नेपाल --- lib/country_codes.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/country_codes.dart b/lib/country_codes.dart index 993be09..75b007e 100644 --- a/lib/country_codes.dart +++ b/lib/country_codes.dart @@ -770,7 +770,7 @@ List> codes = [ "dial_code": "+674", }, { - "name": "नपल", + "name": "नेपाल", "code": "NP", "dial_code": "+977", }, From 803d41cf6da0f20707c21e63b3d3b0ee64a400b0 Mon Sep 17 00:00:00 2001 From: alfredo-handcash Date: Thu, 13 May 2021 10:05:26 +0200 Subject: [PATCH 2/3] make const list to use in constructor --- lib/country_codes.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/country_codes.dart b/lib/country_codes.dart index 993be09..ab11e3e 100644 --- a/lib/country_codes.dart +++ b/lib/country_codes.dart @@ -1,4 +1,4 @@ -List> codes = [ +const List> codes = [ { "name": "افغانستان", "code": "AF", From e1098ee6c7e70e91815d1259fef97234b58c1c52 Mon Sep 17 00:00:00 2001 From: alfredo-handcash Date: Thu, 13 May 2021 10:05:46 +0200 Subject: [PATCH 3/3] pass codes in constructor --- lib/country_code_picker.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/country_code_picker.dart b/lib/country_code_picker.dart index 1ba6ded..1d56969 100644 --- a/lib/country_code_picker.dart +++ b/lib/country_code_picker.dart @@ -80,6 +80,10 @@ class CountryCodePicker extends StatefulWidget { /// [BoxDecoration] for the flag image final Decoration? flagDecoration; + /// An optional argument for inject list of countries + /// with customized codes. + final List> countryList; + CountryCodePicker({ this.onChanged, this.onInit, @@ -113,12 +117,13 @@ class CountryCodePicker extends StatefulWidget { this.dialogSize, this.dialogBackgroundColor, this.closeIcon = const Icon(Icons.close), + this.countryList = codes, Key? key, }) : super(key: key); @override State createState() { - List jsonList = codes; + List jsonList = countryList; List elements = jsonList .map((json) => CountryCode.fromJson(json as Map))