fix : publish the initial selection when the country picker is first initiated.

This commit is contained in:
Jerry Hanks
2018-09-16 12:25:27 +01:00
parent 0d60cf16e7
commit 478965f2c3

View File

@@ -93,6 +93,9 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
null) null)
.toList(); .toList();
super.initState(); super.initState();
_publishSelection(selectedItem);
} }
void _showSelectionDialog() { void _showSelectionDialog() {
@@ -105,10 +108,14 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
selectedItem = e; selectedItem = e;
}); });
if (widget.onChanged != null) { _publishSelection(e);
widget.onChanged(e);
}
} }
}); });
} }
void _publishSelection(CElement e) {
if (widget.onChanged != null) {
widget.onChanged(e);
}
}
} }