Merge pull request #1 from HandCash/feat/inject-list-countries

Feat/inject list countries
This commit is contained in:
Alfredo Bautista
2021-05-13 10:06:17 +02:00
committed by GitHub
2 changed files with 7 additions and 2 deletions

View File

@@ -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>))

View File

@@ -1,4 +1,4 @@
List<Map<String, String>> codes = [
const List<Map<String, String>> codes = [
{
"name": "افغانستان",
"code": "AF",