geolocation first
This commit is contained in:
parent
4a04520800
commit
af65dc1cb0
@ -56,8 +56,7 @@ class _MapboxPagesState extends State<MapboxPages> with ShowErrorDialog {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_initToken();
|
_getUserLocation();
|
||||||
_getEventInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _initToken() {
|
void _initToken() {
|
||||||
@ -80,7 +79,7 @@ class _MapboxPagesState extends State<MapboxPages> with ShowErrorDialog {
|
|||||||
var events = jsonDecode(utf8.decode(responseGet.bodyBytes));
|
var events = jsonDecode(utf8.decode(responseGet.bodyBytes));
|
||||||
latitude = events["latitude"];
|
latitude = events["latitude"];
|
||||||
longitude = events["longitude"];
|
longitude = events["longitude"];
|
||||||
_getUserLocation();
|
|
||||||
setState(() {
|
setState(() {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
});
|
});
|
||||||
@ -154,6 +153,8 @@ class _MapboxPagesState extends State<MapboxPages> with ShowErrorDialog {
|
|||||||
userPosition = LatLng(position.latitude, position.longitude);
|
userPosition = LatLng(position.latitude, position.longitude);
|
||||||
isUserPositionInitialized = true;
|
isUserPositionInitialized = true;
|
||||||
});
|
});
|
||||||
|
_initToken();
|
||||||
|
_getEventInfo();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showErrorDialog(context, "Failed to get user location: $e");
|
showErrorDialog(context, "Failed to get user location: $e");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user