Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we pass a custom list to the showCountryPicker? #41

Open
FinnHo1984 opened this issue Aug 28, 2021 · 2 comments
Open

Can we pass a custom list to the showCountryPicker? #41

FinnHo1984 opened this issue Aug 28, 2021 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@FinnHo1984
Copy link

No description provided.

@FinnHo1984
Copy link
Author

I mean replace List<Map<String, dynamic>> countryCodes to my own list.

@Daniel-Ioannou Daniel-Ioannou added the documentation Improvements or additions to documentation label Aug 31, 2021
@Daniel-Ioannou
Copy link
Owner

Daniel-Ioannou commented Aug 31, 2021

If you mean to filter the countries list and show only selected sub-list of countries, you can use countryFilter
For example to show only Australia, Canada and United States

showCountryPicker(
  context: context,
  countryFilter: <String>['AU', 'US', 'CA', ],
  onSelect: (Country country) {
    print('Select country: ${country.displayName}');
  },
);

Also, if you just want to remove some countries use exclude :

showCountryPicker(
  context: context,
  exclude: <String>['KN', 'MF'],
  onSelect: (Country country) {
    print('Select country: ${country.displayName}');
  },
);

Note: Can't provide both exclude and countryFilter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants