Added own parameter for showOnlyCountryWhenClosed

this is for compatibility to prev 1.1.5 version

added alignLeft parameter
this aligns the flag and the text left and uses more space

added additional examples
This commit is contained in:
Benni Heiss
2019-03-28 17:27:27 +01:00
parent 7cec16c29d
commit 11645ed088
3 changed files with 80 additions and 26 deletions

View File

@@ -21,13 +21,44 @@ class _MyAppState extends State<MyApp> {
appBar: new AppBar(
title: const Text('CountryPicker Example'),
),
body: new Center(
child: new CountryCodePicker(
onChanged: print,
// Initial selection and favorite can be one of code ('IT') OR dial_code('+39')
initialSelection: 'IT',
showCountryOnly: true,
favorite: ['+39', 'FR']),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
CountryCodePicker(
onChanged: print,
// Initial selection and favorite can be one of code ('IT') OR dial_code('+39')
initialSelection: 'IT',
favorite: ['+39', 'FR']),
SizedBox(
width: 400,
height: 60,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: CountryCodePicker(
onChanged: print,
initialSelection: 'TF',
showCountryOnly: true,
showOnlyCountryWhenClosed: true,
alignLeft: true,
),
),
),
SizedBox(
width: 400,
height: 60,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: CountryCodePicker(
onChanged: print,
initialSelection: 'TF',
showCountryOnly: true,
showOnlyCountryWhenClosed: true,
favorite: ['+39', 'FR']),
),
),
],
),
)));
}
}