From fb538f5b6bbdfeecedb59ca45d354347423b35ff Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Mon, 24 Feb 2025 12:00:31 +0200 Subject: [PATCH] add load when location api is called --- Frontend/lib/mih_apis/mih_location_api.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Frontend/lib/mih_apis/mih_location_api.dart b/Frontend/lib/mih_apis/mih_location_api.dart index 97247977..b7fd9aea 100644 --- a/Frontend/lib/mih_apis/mih_location_api.dart +++ b/Frontend/lib/mih_apis/mih_location_api.dart @@ -1,3 +1,4 @@ +import 'package:Mzansi_Innovation_Hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; import '../mih_components/mih_pop_up_messages/mih_error_message.dart'; @@ -13,6 +14,12 @@ class MIHLocationAPI { ///if user has blocked permission (denied or denied forver), user will get error pop up. ///if user has granted permission (while in use), function will return Position object. Future getGPSPosition(BuildContext context) async { + showDialog( + context: context, + builder: (context) { + return const Mihloadingcircle(); + }, + ); //Check the type of permission granted LocationPermission permission = await Geolocator.checkPermission(); if (permission == LocationPermission.denied) { @@ -39,6 +46,7 @@ class MIHLocationAPI { Position location = await Geolocator.getCurrentPosition( locationSettings: locationSettings); //print(location); + Navigator.of(context).pop(); return location; } }