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)) 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",