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