fix showflagdialog and main to override the showflag property
This commit is contained in:
@@ -38,9 +38,8 @@ class _MyAppState extends State<MyApp> {
|
||||
// Initial selection and favorite can be one of code ('IT') OR dial_code('+39')
|
||||
initialSelection: 'IT',
|
||||
favorite: ['+39', 'FR'],
|
||||
showFlag: false,
|
||||
countryFilter: ['IT', 'FR'],
|
||||
showFlagDialog: true,
|
||||
showFlagDialog: false,
|
||||
comparator: (a, b) => b.name.compareTo(a.name),
|
||||
//Get the country information relevant to the initial selection
|
||||
onInit: (code) =>
|
||||
@@ -53,14 +52,13 @@ class _MyAppState extends State<MyApp> {
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: CountryCodePicker(
|
||||
onChanged: print,
|
||||
showFlagMain: true,
|
||||
showFlag: false,
|
||||
initialSelection: 'TF',
|
||||
hideSearch: true,
|
||||
showCountryOnly: true,
|
||||
showOnlyCountryWhenClosed: true,
|
||||
alignLeft: true,
|
||||
builder: (countryCode) {
|
||||
return Text('${countryCode.code}');
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -132,7 +132,9 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
||||
direction: Axis.horizontal,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
if (widget.showFlag || (widget.showFlagMain == true))
|
||||
if (widget.showFlagMain != null
|
||||
? widget.showFlagMain
|
||||
: widget.showFlag)
|
||||
Flexible(
|
||||
flex: widget.alignLeft ? 0 : 1,
|
||||
fit: widget.alignLeft ? FlexFit.tight : FlexFit.loose,
|
||||
@@ -231,7 +233,9 @@ class CountryCodePickerState extends State<CountryCodePicker> {
|
||||
searchDecoration: widget.searchDecoration,
|
||||
searchStyle: widget.searchStyle,
|
||||
textStyle: widget.dialogTextStyle,
|
||||
showFlag: widget.showFlag || (widget.showFlagDialog == true),
|
||||
showFlag: widget.showFlagDialog != null
|
||||
? widget.showFlagDialog
|
||||
: widget.showFlag,
|
||||
flagWidth: widget.flagWidth,
|
||||
size: widget.dialogSize,
|
||||
hideSearch: widget.hideSearch,
|
||||
|
||||
Reference in New Issue
Block a user