diff --git a/CHANGELOG.md b/CHANGELOG.md index b3297d4..d9cdf9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## 1.3.0 +- Add `flagWidth` property + +## 1.3.0 + - Fixed selection dialog length - Added i18n with `CountryLocalizations` diff --git a/lib/country_code_picker.dart b/lib/country_code_picker.dart index 0c40ff0..ea546ad 100644 --- a/lib/country_code_picker.dart +++ b/lib/country_code_picker.dart @@ -36,6 +36,9 @@ class CountryCodePicker extends StatefulWidget { /// contains the country codes to load only the specified countries. final List countryFilter; + /// Width of the flag images + final double flagWidth; + CountryCodePicker({ this.onChanged, this.onInit, @@ -52,6 +55,7 @@ class CountryCodePicker extends StatefulWidget { this.alignLeft = false, this.showFlag = true, this.builder, + this.flagWidth = 32.0, }); @override @@ -103,7 +107,7 @@ class _CountryCodePickerState extends State { child: Image.asset( selectedItem.flagUri, package: 'country_code_picker', - width: 32.0, + width: widget.flagWidth, ), ), ) @@ -177,6 +181,7 @@ class _CountryCodePickerState extends State { searchDecoration: widget.searchDecoration, searchStyle: widget.searchStyle, showFlag: widget.showFlag, + flagWidth: widget.flagWidth, ), ).then((e) { if (e != null) { diff --git a/lib/selection_dialog.dart b/lib/selection_dialog.dart index 46cba2e..36f2f78 100644 --- a/lib/selection_dialog.dart +++ b/lib/selection_dialog.dart @@ -9,18 +9,22 @@ class SelectionDialog extends StatefulWidget { final TextStyle searchStyle; final WidgetBuilder emptySearchBuilder; final bool showFlag; + final double flagWidth; /// elements passed as favorite final List favoriteElements; - SelectionDialog(this.elements, this.favoriteElements, - {Key key, - this.showCountryOnly, - this.emptySearchBuilder, - InputDecoration searchDecoration = const InputDecoration(), - this.searchStyle, - this.showFlag}) - : assert(searchDecoration != null, 'searchDecoration must not be null!'), + SelectionDialog( + this.elements, + this.favoriteElements, { + Key key, + this.showCountryOnly, + this.emptySearchBuilder, + InputDecoration searchDecoration = const InputDecoration(), + this.searchStyle, + this.showFlag, + this.flagWidth = 32, + }) : assert(searchDecoration != null, 'searchDecoration must not be null!'), this.searchDecoration = searchDecoration.copyWith(prefixIcon: Icon(Icons.search)), super(key: key); @@ -97,7 +101,7 @@ class _SelectionDialogState extends State { child: Image.asset( e.flagUri, package: 'country_code_picker', - width: 32.0, + width: widget.flagWidth, ), ), ), diff --git a/pubspec.yaml b/pubspec.yaml index 374219f..cd87590 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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.0 +version: 1.3.1 homepage: https://github.com/Salvatore-Giordano/CountryCodePicker environment: