add hideMainText property
This commit is contained in:
@@ -52,6 +52,7 @@ class _MyAppState extends State<MyApp> {
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: CountryCodePicker(
|
child: CountryCodePicker(
|
||||||
onChanged: print,
|
onChanged: print,
|
||||||
|
hideMainText: true,
|
||||||
showFlagMain: true,
|
showFlagMain: true,
|
||||||
showFlag: false,
|
showFlag: false,
|
||||||
initialSelection: 'TF',
|
initialSelection: 'TF',
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ class CountryCodePicker extends StatefulWidget {
|
|||||||
/// shows the flag
|
/// shows the flag
|
||||||
final bool showFlag;
|
final bool showFlag;
|
||||||
|
|
||||||
|
final bool hideMainText;
|
||||||
|
|
||||||
final bool showFlagMain;
|
final bool showFlagMain;
|
||||||
|
|
||||||
final bool showFlagDialog;
|
final bool showFlagDialog;
|
||||||
@@ -71,6 +73,7 @@ class CountryCodePicker extends StatefulWidget {
|
|||||||
this.alignLeft = false,
|
this.alignLeft = false,
|
||||||
this.showFlag = true,
|
this.showFlag = true,
|
||||||
this.showFlagDialog,
|
this.showFlagDialog,
|
||||||
|
this.hideMainText = false,
|
||||||
this.showFlagMain,
|
this.showFlagMain,
|
||||||
this.builder,
|
this.builder,
|
||||||
this.flagWidth = 32.0,
|
this.flagWidth = 32.0,
|
||||||
@@ -149,16 +152,17 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Flexible(
|
if (!widget.hideMainText)
|
||||||
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,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user