Skip to content

Commit d3bf5f4

Browse files
Merge pull request chandrabezzo#1 from HandCash/feat/inject-list-countries
Feat/inject list countries
2 parents db13f6e + e1098ee commit d3bf5f4

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/country_code_picker.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ class CountryCodePicker extends StatefulWidget {
8080
/// [BoxDecoration] for the flag image
8181
final Decoration? flagDecoration;
8282

83+
/// An optional argument for inject list of countries
84+
/// with customized codes.
85+
final List<Map<String, dynamic>> countryList;
86+
8387
CountryCodePicker({
8488
this.onChanged,
8589
this.onInit,
@@ -113,12 +117,13 @@ class CountryCodePicker extends StatefulWidget {
113117
this.dialogSize,
114118
this.dialogBackgroundColor,
115119
this.closeIcon = const Icon(Icons.close),
120+
this.countryList = codes,
116121
Key? key,
117122
}) : super(key: key);
118123

119124
@override
120125
State<StatefulWidget> createState() {
121-
List<Map> jsonList = codes;
126+
List<Map> jsonList = countryList;
122127

123128
List<CountryCode> elements = jsonList
124129
.map((json) => CountryCode.fromJson(json as Map<String, dynamic>))

lib/country_codes.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
List<Map<String, String>> codes = [
1+
const List<Map<String, String>> codes = [
22
{
33
"name": "افغانستان",
44
"code": "AF",

0 commit comments

Comments
 (0)