From 9cab5a908dc31575c1ee3e4bc7f0bb3eab8e3ab1 Mon Sep 17 00:00:00 2001 From: Felipe Date: Thu, 26 Oct 2023 11:11:23 -0500 Subject: [PATCH] busca la ciudad --- lib/src/screens/service.dart | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/src/screens/service.dart b/lib/src/screens/service.dart index f36c704..642c6f9 100644 --- a/lib/src/screens/service.dart +++ b/lib/src/screens/service.dart @@ -226,9 +226,25 @@ class _ServiceScreenState extends State { if (_coordsOfCity == '0.0,0.0') { AuthenticationRepository.instance .getCoordsOfCity(uid.toString()) - .then((String s) => setState(() { - _coordsOfCity = s; - })); + .then((String s) { + setState(() { + _coordsOfCity = s; + }); + + if (_coordsOfCity != '0.0,0.0') { + List coords = _coordsOfCity.split(','); + double lat = double.parse(coords[0]); + double lng = double.parse(coords[1]); + + // Asegúrate de que googleMapController esté disponible y no sea nulo + googleMapController.moveCamera( + CameraUpdate.newLatLngZoom( + LatLng(lat, lng), + 14.4746, // Puedes ajustar el nivel de zoom según tus necesidades + ), + ); + } + }); } _saveToken();