Merge pull request #77 from simon-twonary/shows-the-flag-only-when-closed

Shows the flag only when closed
This commit is contained in:
Salvatore Giordano
2020-05-16 13:13:52 +02:00
committed by GitHub

View File

@@ -42,6 +42,7 @@ class CountryCodePicker extends StatefulWidget {
/// shows the flag /// shows the flag
final bool showFlag; final bool showFlag;
/// shows the flag only when closed
final bool showFlagMain; final bool showFlagMain;
final bool showFlagDialog; final bool showFlagDialog;
@@ -71,7 +72,7 @@ class CountryCodePicker extends StatefulWidget {
this.alignLeft = false, this.alignLeft = false,
this.showFlag = true, this.showFlag = true,
this.showFlagDialog, this.showFlagDialog,
this.showFlagMain, this.showFlagMain = false,
this.builder, this.builder,
this.flagWidth = 32.0, this.flagWidth = 32.0,
this.enabled = true, this.enabled = true,
@@ -147,16 +148,17 @@ class CountryCodePickerState extends State<CountryCodePicker> {
), ),
), ),
), ),
Flexible( if (widget.showFlagMain == false)
fit: widget.alignLeft ? FlexFit.tight : FlexFit.loose, Flexible(
child: Text( fit: widget.alignLeft ? FlexFit.tight : FlexFit.loose,
widget.showOnlyCountryWhenClosed child: Text(
? selectedItem.toCountryStringOnly() widget.showOnlyCountryWhenClosed
: selectedItem.toString(), ? selectedItem.toCountryStringOnly()
style: widget.textStyle ?? Theme.of(context).textTheme.button, : selectedItem.toString(),
overflow: widget.textOverflow, style: widget.textStyle ?? Theme.of(context).textTheme.button,
overflow: widget.textOverflow,
),
), ),
),
], ],
), ),
); );