Refs #30: optional flag
This commit is contained in:
@@ -28,6 +28,9 @@ class CountryCodePicker extends StatefulWidget {
|
||||
/// because longer countrynames are displayed in one line
|
||||
final bool alignLeft;
|
||||
|
||||
/// shows the flag
|
||||
final bool showFlag;
|
||||
|
||||
CountryCodePicker({
|
||||
this.onChanged,
|
||||
this.initialSelection,
|
||||
@@ -40,6 +43,7 @@ class CountryCodePicker extends StatefulWidget {
|
||||
this.emptySearchBuilder,
|
||||
this.showOnlyCountryWhenClosed = false,
|
||||
this.alignLeft = false,
|
||||
this.showFlag = true
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -72,7 +76,7 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
|
||||
direction: Axis.horizontal,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
widget.showFlag ? Flexible(
|
||||
flex: widget.alignLeft ? 0 : 1,
|
||||
fit: widget.alignLeft ? FlexFit.tight : FlexFit.loose,
|
||||
child: Padding(
|
||||
@@ -85,7 +89,7 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
|
||||
width: 32.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
) : Container(),
|
||||
Flexible(
|
||||
fit: widget.alignLeft ? FlexFit.tight : FlexFit.loose,
|
||||
child: Text(
|
||||
@@ -134,6 +138,7 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
|
||||
emptySearchBuilder: widget.emptySearchBuilder,
|
||||
searchDecoration: widget.searchDecoration,
|
||||
searchStyle: widget.searchStyle,
|
||||
showFlag: widget.showFlag
|
||||
),
|
||||
).then((e) {
|
||||
if (e != null) {
|
||||
|
||||
@@ -8,6 +8,7 @@ class SelectionDialog extends StatefulWidget {
|
||||
final InputDecoration searchDecoration;
|
||||
final TextStyle searchStyle;
|
||||
final WidgetBuilder emptySearchBuilder;
|
||||
final bool showFlag;
|
||||
|
||||
/// elements passed as favorite
|
||||
final List<CountryCode> favoriteElements;
|
||||
@@ -18,6 +19,7 @@ class SelectionDialog extends StatefulWidget {
|
||||
this.emptySearchBuilder,
|
||||
InputDecoration searchDecoration = const InputDecoration(),
|
||||
this.searchStyle,
|
||||
this.showFlag
|
||||
}) :
|
||||
assert(searchDecoration != null, 'searchDecoration must not be null!'),
|
||||
this.searchDecoration = searchDecoration.copyWith(prefixIcon: Icon(Icons.search)),
|
||||
@@ -85,7 +87,7 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
child: Flex(
|
||||
direction: Axis.horizontal,
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
widget.showFlag ? Flexible(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 16.0),
|
||||
child: Image.asset(
|
||||
@@ -94,7 +96,7 @@ class _SelectionDialogState extends State<SelectionDialog> {
|
||||
width: 32.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
) : Container(),
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Text(
|
||||
|
||||
@@ -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.1.5
|
||||
version: 1.1.6
|
||||
author: Salvatore-Giordano <svtgiordano@gmail.com>
|
||||
homepage: https://github.com/Salvatore-Giordano/CountryCodePicker
|
||||
|
||||
|
||||
Reference in New Issue
Block a user