Skip to content
This repository has been archived by the owner on Jul 20, 2022. It is now read-only.

Fest/inect-list-countries #150

Merged
merged 3 commits into from
Jun 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/country_code_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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>))
Expand Down
2 changes: 1 addition & 1 deletion lib/country_codes.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
List<Map<String, String>> codes = [
const List<Map<String, String>> codes = [
{
"name": "افغانستان",
"code": "AF",
Expand Down