diff --git a/packages/smooth_app/lib/pages/onboarding/country_selector.dart b/packages/smooth_app/lib/pages/onboarding/country_selector.dart index 6e6bbc927a2..a666f0736c7 100644 --- a/packages/smooth_app/lib/pages/onboarding/country_selector.dart +++ b/packages/smooth_app/lib/pages/onboarding/country_selector.dart @@ -62,7 +62,7 @@ class _CountrySelectorState extends State { return GestureDetector( onTap: () async { List filteredList = List.from(_countryList); - await showDialog( + final Country? country = await showDialog( context: context, builder: (BuildContext context) { return StatefulBuilder( @@ -109,12 +109,8 @@ class _CountrySelectorState extends State { final Country country = filteredList[index]; return ListTile( title: Text(country.name), - onTap: () async { - _chosenValue = country; - await _setUserCountry( - _chosenValue.countryCode); - setState(() {}); - Navigator.of(context).pop(); + onTap: () { + Navigator.of(context).pop(country); }, ); }, @@ -134,6 +130,11 @@ class _CountrySelectorState extends State { ); }, ); + if (country != null) { + _chosenValue = country; + await _setUserCountry(_chosenValue.countryCode); + } + setState(() {}); }, child: Container( decoration: BoxDecoration(