From 840a95f097f85cff88e2c18047a34d561166d2c6 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 12 Nov 2022 15:04:40 +0800 Subject: [PATCH] fix refCountryCode in bottomsheet issue --- CHANGELOG.md | 4 ++++ example/lib/main.dart | 3 ++- example/pubspec.lock | 2 +- lib/country_selector.dart | 5 +++-- pubspec.yaml | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 038f9a2..71096e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,3 +33,7 @@ ## 0.0.9 * Fix refCountryCode issues + +## 0.1.0 + +* Fix refCountryCode issues in showCountrySelectorBottomSheet diff --git a/example/lib/main.dart b/example/lib/main.dart index 3e2279d..f249de9 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -67,7 +67,8 @@ class App extends StatelessWidget { // show country selector bottom sheet widget await showCountrySelectorBottomSheet( context: context, - // callback of the selected country + // set the default selected country + refCountryCode: "HK", onSelectedCountry: (country) async { // dialog to show the info of the country object await showSuccessDialog( diff --git a/example/pubspec.lock b/example/pubspec.lock index 301de9c..fcdf976 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -42,7 +42,7 @@ packages: path: ".." relative: true source: path - version: "0.0.6" + version: "0.1.0" cupertino_icons: dependency: "direct main" description: diff --git a/lib/country_selector.dart b/lib/country_selector.dart index aed8580..cef79fc 100644 --- a/lib/country_selector.dart +++ b/lib/country_selector.dart @@ -4,6 +4,7 @@ library country_selector_widget; export 'const/enum.dart'; export 'const/country.dart'; +import 'dart:async'; import 'package:flutter/material.dart'; import 'package:country_selector_widget/country_selector.dart'; import 'package:country_selector_widget/data/coutnry_list.dart'; @@ -83,6 +84,7 @@ Future showCountrySelectorBottomSheet({ ), ), }) async { + // # await showModalBottomSheet( isScrollControlled: true, backgroundColor: Colors.transparent, @@ -96,6 +98,7 @@ Future showCountrySelectorBottomSheet({ height: bottomSheetHeight ?? MediaQuery.of(context).size.height * 0.8, child: CountrySelectorWidget( customAppBar: customAppBar, + refCountryCode: refCountryCode, bottomAppBarHeight: bottomAppBarHeight, continueBtnPadding: continueBtnPadding, selectedLocale: selectedLocale, @@ -235,7 +238,6 @@ class CountrySelectorWidget extends StatefulWidget { class CountrySelectorWidgetState extends State { late ScrollController _scrollController; late List _countries; - late List _widgetHeight; late ValueNotifier?> _countriesNotifi; late ValueNotifier _selectedCountryNotifi; late TextUtil _textUtil; @@ -247,7 +249,6 @@ class CountrySelectorWidgetState extends State { super.initState(); _textUtil = TextUtil(selectedLocale: widget.selectedLocale); _scrollController = ScrollController(); - _widgetHeight = []; _selectedCountryNotifi = ValueNotifier(null); _countries = []; _countriesNotifi = ValueNotifier(null); diff --git a/pubspec.yaml b/pubspec.yaml index 9176747..138e5f9 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.9 +version: 0.1.0 homepage: https://hkk97.github.io/country_selector_widget/ environment: