From af65dc1cb0c2ef1c34955fb87a1f0221e25c9d83 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 17 Nov 2024 10:58:29 +0100 Subject: [PATCH] geolocation first --- covas_mobile/lib/pages/MapboxPages.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/covas_mobile/lib/pages/MapboxPages.dart b/covas_mobile/lib/pages/MapboxPages.dart index 22df91e..701cda6 100644 --- a/covas_mobile/lib/pages/MapboxPages.dart +++ b/covas_mobile/lib/pages/MapboxPages.dart @@ -56,8 +56,7 @@ class _MapboxPagesState extends State with ShowErrorDialog { @override void initState() { super.initState(); - _initToken(); - _getEventInfo(); + _getUserLocation(); } void _initToken() { @@ -80,7 +79,7 @@ class _MapboxPagesState extends State with ShowErrorDialog { var events = jsonDecode(utf8.decode(responseGet.bodyBytes)); latitude = events["latitude"]; longitude = events["longitude"]; - _getUserLocation(); + setState(() { isLoading = false; }); @@ -154,6 +153,8 @@ class _MapboxPagesState extends State with ShowErrorDialog { userPosition = LatLng(position.latitude, position.longitude); isUserPositionInitialized = true; }); + _initToken(); + _getEventInfo(); } catch (e) { showErrorDialog(context, "Failed to get user location: $e"); }