@@ -80,6 +80,10 @@ class CountryCodePicker extends StatefulWidget {
|
|||||||
/// [BoxDecoration] for the flag image
|
/// [BoxDecoration] for the flag image
|
||||||
final Decoration? flagDecoration;
|
final Decoration? flagDecoration;
|
||||||
|
|
||||||
|
/// An optional argument for inject list of countries
|
||||||
|
/// with customized codes.
|
||||||
|
final List<Map<String, dynamic>> countryList;
|
||||||
|
|
||||||
CountryCodePicker({
|
CountryCodePicker({
|
||||||
this.onChanged,
|
this.onChanged,
|
||||||
this.onInit,
|
this.onInit,
|
||||||
@@ -113,12 +117,13 @@ class CountryCodePicker extends StatefulWidget {
|
|||||||
this.dialogSize,
|
this.dialogSize,
|
||||||
this.dialogBackgroundColor,
|
this.dialogBackgroundColor,
|
||||||
this.closeIcon = const Icon(Icons.close),
|
this.closeIcon = const Icon(Icons.close),
|
||||||
|
this.countryList = codes,
|
||||||
Key? key,
|
Key? key,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() {
|
State<StatefulWidget> createState() {
|
||||||
List<Map> jsonList = codes;
|
List<Map> jsonList = countryList;
|
||||||
|
|
||||||
List<CountryCode> elements = jsonList
|
List<CountryCode> elements = jsonList
|
||||||
.map((json) => CountryCode.fromJson(json as Map<String, dynamic>))
|
.map((json) => CountryCode.fromJson(json as Map<String, dynamic>))
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
List<Map<String, String>> codes = [
|
const List<Map<String, String>> codes = [
|
||||||
{
|
{
|
||||||
"name": "افغانستان",
|
"name": "افغانستان",
|
||||||
"code": "AF",
|
"code": "AF",
|
||||||
|
|||||||
Reference in New Issue
Block a user