From 478965f2c3938f9133b7251f2aa754b1064f5aef Mon Sep 17 00:00:00 2001 From: Jerry Hanks Date: Sun, 16 Sep 2018 12:25:27 +0100 Subject: [PATCH] fix : publish the initial selection when the country picker is first initiated. --- lib/country_code_picker.dart | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/country_code_picker.dart b/lib/country_code_picker.dart index 7bbda07..d525f3d 100644 --- a/lib/country_code_picker.dart +++ b/lib/country_code_picker.dart @@ -93,6 +93,9 @@ class _CountryCodePickerState extends State { null) .toList(); super.initState(); + + _publishSelection(selectedItem); + } void _showSelectionDialog() { @@ -105,10 +108,14 @@ class _CountryCodePickerState extends State { selectedItem = e; }); - if (widget.onChanged != null) { - widget.onChanged(e); - } + _publishSelection(e); } }); } + + void _publishSelection(CElement e) { + if (widget.onChanged != null) { + widget.onChanged(e); + } + } }