Merge pull request #1 from HandCash/feat/inject-list-countries
Feat/inject list countries
This commit is contained in:
@@ -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<Map<String, dynamic>> 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<StatefulWidget> createState() {
|
||||
List<Map> jsonList = codes;
|
||||
List<Map> jsonList = countryList;
|
||||
|
||||
List<CountryCode> elements = jsonList
|
||||
.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": "افغانستان",
|
||||
"code": "AF",
|
||||
|
||||
Reference in New Issue
Block a user