added reset

This commit is contained in:
Mohamed Nouffer
2023-01-26 20:09:33 +05:30
parent ad61ab2b16
commit 03b586651d
3 changed files with 32 additions and 14 deletions

View File

@ -129,6 +129,7 @@ class DestinationController extends GetxController {
}
void startTimer(Destination d, double distance) async {
print("=== passed dest is ${d.location_id} ${d.checkedin} ====");
skip_gps = true;
print("---- in startTimer ----");
double checkin_radious = d.checkin_radious ?? double.infinity;
@ -284,26 +285,38 @@ class DestinationController extends GetxController {
});
}
}
print("---- _chekcs ${chekcs} ----");
print("==== _chekcs ${chekcs} ====");
if(chekcs == 0){
skip_gps = false;
}
}
void resetRogaining(){
currentSelectedDestinations.forEach((element) {
deleteDestination(element);
});
print("----- resetting --------");
is_in_checkin.value = false;
is_in_rog.value = false;
is_at_start.value = false;
is_at_goal.value = false;
is_gps_selected.value = true;
skip_gps = false;
_start = 0;
chekcs = 0;
rogaining_counted.value = false;
DatabaseHelper db = DatabaseHelper.instance;
db.deleteAllDestinations().then((value){
PopulateDestinations();
initGPS();
});
// currentSelectedDestinations.forEach((element) {
// deleteDestination(element);
// });
}
void openCamera(BuildContext context) {
@ -439,10 +452,7 @@ class DestinationController extends GetxController {
}
@override
void onInit() async {
void initGPS(){
checkPermission();
PopulateDestinations();
@ -468,7 +478,6 @@ class DestinationController extends GetxController {
accuracy: LocationAccuracy.bestForNavigation,
activityType: ActivityType.fitness,
distanceFilter: 0,
timeLimit: Duration(seconds: 1),
pauseLocationUpdatesAutomatically: false,
// Only set to true if our app will be started up in the background.
showBackgroundLocationIndicator: true
@ -488,6 +497,8 @@ class DestinationController extends GetxController {
current_lat = position != null ? position.latitude : 0;
current_lon = position != null ? position.longitude : 0;
print("==== gps skip is : ${skip_gps.toString()}, selected is ${is_gps_selected} , ${current_lat}");
if(is_gps_selected.value){
double czoom = indexController.rogMapController!.zoom;
indexController.rogMapController!.move(LatLng(position!.latitude, position!.longitude), czoom);
@ -510,6 +521,13 @@ class DestinationController extends GetxController {
}
ever(indexController.connectionStatusName, connectionChanged);
}
@override
void onInit() async {
initGPS();
super.onInit();