From da2a89d38959363856593d4a61c605fe46dfc6c1 Mon Sep 17 00:00:00 2001 From: simon <59780143+simon-twonary@users.noreply.github.com> Date: Wed, 6 May 2020 03:11:49 -0400 Subject: [PATCH] Implement shows the flag only when closed fix `showFlagMain` flag. shows the flag only when closed --- lib/country_code_picker.dart | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/country_code_picker.dart b/lib/country_code_picker.dart index 3a56eed..c8ab6ca 100644 --- a/lib/country_code_picker.dart +++ b/lib/country_code_picker.dart @@ -42,6 +42,7 @@ class CountryCodePicker extends StatefulWidget { /// shows the flag final bool showFlag; + /// shows the flag only when closed final bool showFlagMain; final bool showFlagDialog; @@ -71,7 +72,7 @@ class CountryCodePicker extends StatefulWidget { this.alignLeft = false, this.showFlag = true, this.showFlagDialog, - this.showFlagMain, + this.showFlagMain = false, this.builder, this.flagWidth = 32.0, this.enabled = true, @@ -147,16 +148,17 @@ class CountryCodePickerState extends State { ), ), ), - Flexible( - fit: widget.alignLeft ? FlexFit.tight : FlexFit.loose, - child: Text( - widget.showOnlyCountryWhenClosed - ? selectedItem.toCountryStringOnly() - : selectedItem.toString(), - style: widget.textStyle ?? Theme.of(context).textTheme.button, - overflow: widget.textOverflow, + if (widget.showFlagMain == false) + Flexible( + fit: widget.alignLeft ? FlexFit.tight : FlexFit.loose, + child: Text( + widget.showOnlyCountryWhenClosed + ? selectedItem.toCountryStringOnly() + : selectedItem.toString(), + style: widget.textStyle ?? Theme.of(context).textTheme.button, + overflow: widget.textOverflow, + ), ), - ), ], ), );