From a5f4db58366a13b5af9f6b6544ded983fa580da6 Mon Sep 17 00:00:00 2001 From: Juan Felipe Duarte <70235683+DuarteJFelipe@users.noreply.github.com> Date: Wed, 12 Apr 2023 11:51:05 -0500 Subject: [PATCH] picker city update --- lib/src/screens/city.dart | 2 +- lib/src/screens/profile.dart | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/src/screens/city.dart b/lib/src/screens/city.dart index dcbdbe0..b74c141 100644 --- a/lib/src/screens/city.dart +++ b/lib/src/screens/city.dart @@ -187,7 +187,7 @@ class _CityScreenState extends State { ), onTap: () { updateCity(citys[index].cityName ?? ""); - Navigator.pushReplacementNamed(context, '/profile'); + Navigator.pop(context, citys[index].cityName ?? ""); }, ); }, diff --git a/lib/src/screens/profile.dart b/lib/src/screens/profile.dart index 7138959..bdc3171 100644 --- a/lib/src/screens/profile.dart +++ b/lib/src/screens/profile.dart @@ -428,15 +428,27 @@ class _ProfileScreenState extends State { 20.0), // Agrega espacio vertical entre los TextFormFields TextFormField( readOnly: true, - onTap: () { - Navigator.pushReplacementNamed(context, '/city'); + onTap: () async { + final String? ciudad = + (await Navigator.pushNamed(context, '/city')) + as String?; + + if (ciudad != null) { + setState(() { + _ciudad = ciudad as String; + }); + } }, decoration: InputDecoration( - prefixIcon: Icon(Icons.near_me), - suffixIcon: Icon(Icons.arrow_drop_down), - hintText: city == '' ? 'Ciudad' : '$city', - hintStyle: TextStyle(color: Colors.black87), - ), + prefixIcon: Icon(Icons.near_me), + suffixIcon: Icon(Icons.arrow_drop_down), + hintStyle: city == '' + ? TextStyle() + : TextStyle(color: Colors.black87), + hintText: city == '' + ? 'Profesión (Obligatorio)' + : '$city'), + // hintText: city == '' ? 'Ciudad' : '$city', ), SizedBox(