refactored selectiondialog _buildoption

OnlyCountrymode now also displays only country when closed
width doesn't change on search
This commit is contained in:
Benni Heiss
2019-03-26 11:20:17 +01:00
parent 13b14fa296
commit 71ca7a0b34
3 changed files with 36 additions and 55 deletions

View File

@@ -1,4 +1,3 @@
library country_code_picker;
import 'package:country_code_picker/country_code.dart';
@@ -67,7 +66,9 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
),
Flexible(
child: Text(
selectedItem.toString(),
widget.showCountryOnly
? selectedItem.toCountryStringOnly()
: selectedItem.toString(),
style: widget.textStyle ?? Theme.of(context).textTheme.button,
),
),
@@ -106,7 +107,8 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
void _showSelectionDialog() {
showDialog(
context: context,
builder: (_) => new SelectionDialog(elements, favoriteElements, showCountryOnly: widget.showCountryOnly),
builder: (_) => new SelectionDialog(elements, favoriteElements,
showCountryOnly: widget.showCountryOnly),
).then((e) {
if (e != null) {
setState(() {