From 7ce8c43ccbe48f7e20db8f3d2df815e8f71c76f5 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 12 Nov 2022 14:40:52 +0800 Subject: [PATCH] fix refCountryCode issue --- CHANGELOG.md | 4 ++++ example/lib/main.dart | 2 +- lib/country_selector.dart | 3 ++- pubspec.yaml | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dcebe5..038f9a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,3 +29,7 @@ ## 0.0.8 * Add refCountryCode and Update README.md + +## 0.0.9 + +* Fix refCountryCode issues diff --git a/example/lib/main.dart b/example/lib/main.dart index a40ac36..3e2279d 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -101,7 +101,7 @@ class App extends StatelessWidget { // select the Chinese locale to label the text rather than English selectedLocale: SelectedLocale.zhCH, // set the default selected country - refCountryCode: "HK", + refCountryCode: "hk", // callback of the selected country onSelectedCountry: (country) async { // dialog to show the info of the country object diff --git a/lib/country_selector.dart b/lib/country_selector.dart index 1b8bd79..aed8580 100644 --- a/lib/country_selector.dart +++ b/lib/country_selector.dart @@ -257,7 +257,8 @@ class CountrySelectorWidgetState extends State { } if (widget.refCountryCode != null) { List refCountry = _countries - .where((country) => country.code == widget.refCountryCode) + .where( + (country) => country.code == widget.refCountryCode!.toUpperCase()) .toList(); if (refCountry.length == 1) { _selectedCountryNotifi.value = refCountry.first; diff --git a/pubspec.yaml b/pubspec.yaml index 334b550..9176747 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: country_selector_widget description: Country Selector Widget provides CountrySelectorWidget and showCountrySelectorBottomSheet to fulfill the needed usage. -version: 0.0.8 +version: 0.0.9 homepage: https://hkk97.github.io/country_selector_widget/ environment: