version bump

This commit is contained in:
Salvatore Giordano
2020-04-04 16:41:37 +02:00
parent a01ce10810
commit 47a3336058
4 changed files with 19 additions and 17 deletions

View File

@@ -1,3 +1,11 @@
## 1.3.8
- Expose state to let use a key to open the dialog
- Add dialog size config
- Remove customList and fix countryFilter
## 1.3.7
- Add `customList` property

View File

@@ -38,7 +38,7 @@ class _MyAppState extends State<MyApp> {
initialSelection: 'IT',
favorite: ['+39', 'FR'],
showFlag: false,
customList: ['IT', 'FR'],
countryFilter: ['IT', 'FR'],
showFlagDialog: true,
comparator: (a, b) => b.name.compareTo(a.name),
//Get the country information relevant to the initial selection

View File

@@ -26,7 +26,7 @@ class CountryCodePicker extends StatefulWidget {
final Size dialogSize;
/// used to customize the country list
final List<String> customList;
final List<String> countryFilter;
/// shows the name of the country instead of the dialcode
final bool showOnlyCountryWhenClosed;
@@ -45,9 +45,6 @@ class CountryCodePicker extends StatefulWidget {
final bool showFlagDialog;
/// contains the country codes to load only the specified countries.
final List<String> countryFilter;
/// Width of the flag images
final double flagWidth;
@@ -59,7 +56,6 @@ class CountryCodePicker extends StatefulWidget {
this.onInit,
this.initialSelection,
this.favorite = const [],
this.countryFilter = const [],
this.textStyle,
this.padding = const EdgeInsets.all(0.0),
this.showCountryOnly = false,
@@ -76,7 +72,7 @@ class CountryCodePicker extends StatefulWidget {
this.enabled = true,
this.textOverflow = TextOverflow.ellipsis,
this.comparator,
this.customList,
this.countryFilter,
this.dialogSize,
Key key,
}) : super(key: key);
@@ -92,19 +88,17 @@ class CountryCodePicker extends StatefulWidget {
elements.sort(comparator);
}
if (customList != null) {
if (countryFilter != null && countryFilter.isNotEmpty) {
final uppercaseCustomList =
countryFilter.map((c) => c.toUpperCase()).toList();
elements = elements
.where((c) =>
customList.contains(c.code) ||
customList.contains(c.name) ||
customList.contains(c.dialCode))
uppercaseCustomList.contains(c.code) ||
uppercaseCustomList.contains(c.name) ||
uppercaseCustomList.contains(c.dialCode))
.toList();
}
if (countryFilter.length > 0) {
elements = elements.where((c) => countryFilter.contains(c.code)).toList();
}
return CountryCodePickerState(elements);
}
}
@@ -186,7 +180,7 @@ class CountryCodePickerState extends State<CountryCodePicker> {
}
@override
initState() {
void initState() {
if (widget.initialSelection != null) {
selectedItem = elements.firstWhere(
(e) =>

View File

@@ -1,6 +1,6 @@
name: country_code_picker
description: A flutter package for showing a country code selector. In addition it gives the possibility to select a list of favorites countries, as well as to search using a simple searchbox
version: 1.3.7
version: 1.3.8
homepage: https://github.com/imtoori/CountryCodePicker
environment: