Skip to content

Commit

Permalink
fix refCountryCode in bottomsheet issue
Browse files Browse the repository at this point in the history
  • Loading branch information
wchklaus97 committed Nov 12, 2022
1 parent 7ce8c43 commit 840a95f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@
## 0.0.9

* Fix refCountryCode issues

## 0.1.0

* Fix refCountryCode issues in showCountrySelectorBottomSheet
3 changes: 2 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.6"
version: "0.1.0"
cupertino_icons:
dependency: "direct main"
description:
Expand Down
5 changes: 3 additions & 2 deletions lib/country_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -83,6 +84,7 @@ Future<void> showCountrySelectorBottomSheet({
),
),
}) async {
// #
await showModalBottomSheet(
isScrollControlled: true,
backgroundColor: Colors.transparent,
Expand All @@ -96,6 +98,7 @@ Future<void> showCountrySelectorBottomSheet({
height: bottomSheetHeight ?? MediaQuery.of(context).size.height * 0.8,
child: CountrySelectorWidget(
customAppBar: customAppBar,
refCountryCode: refCountryCode,
bottomAppBarHeight: bottomAppBarHeight,
continueBtnPadding: continueBtnPadding,
selectedLocale: selectedLocale,
Expand Down Expand Up @@ -235,7 +238,6 @@ class CountrySelectorWidget extends StatefulWidget {
class CountrySelectorWidgetState extends State<CountrySelectorWidget> {
late ScrollController _scrollController;
late List<Country> _countries;
late List<double> _widgetHeight;
late ValueNotifier<List<Country>?> _countriesNotifi;
late ValueNotifier<Country?> _selectedCountryNotifi;
late TextUtil _textUtil;
Expand All @@ -247,7 +249,6 @@ class CountrySelectorWidgetState extends State<CountrySelectorWidget> {
super.initState();
_textUtil = TextUtil(selectedLocale: widget.selectedLocale);
_scrollController = ScrollController();
_widgetHeight = [];
_selectedCountryNotifi = ValueNotifier(null);
_countries = [];
_countriesNotifi = ValueNotifier(null);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit 840a95f

Please sign in to comment.