added reset
This commit is contained in:
@ -3,7 +3,6 @@ import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/services/external_service.dart';
|
||||
|
||||
class CameraPage extends StatelessWidget {
|
||||
@ -52,7 +51,7 @@ class CameraPage extends StatelessWidget {
|
||||
ExternalService().makeGoal(user_id, _token, _team, destinationController.photos[0].path, formattedDate, _event_code).then((value){
|
||||
print("---called ext api ${value['status']} ------");
|
||||
if(value['status'] == 'OK'){
|
||||
Get.off(AppPages.TRAVEL);
|
||||
Get.back();
|
||||
destinationController.skip_gps = false;
|
||||
Get.snackbar("目標が保存されました", "目標が正常に追加されました");
|
||||
destinationController.resetRogaining();
|
||||
@ -89,7 +88,7 @@ class CameraPage extends StatelessWidget {
|
||||
onPressed: (){
|
||||
|
||||
destinationController.makeCheckin(indexController.currentDestinationFeature[0], true, destinationController.photos[0].path);
|
||||
Get.off(AppPages.TRAVEL);
|
||||
Get.back();
|
||||
destinationController.rogaining_counted.value = true;
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.is_photo_shoot.value = false;
|
||||
@ -188,7 +187,7 @@ class StartRogaining extends StatelessWidget {
|
||||
SizedBox(height: 40.0,),
|
||||
ElevatedButton(
|
||||
onPressed: (){
|
||||
Get.off(AppPages.TRAVEL);
|
||||
Get.back();
|
||||
destinationController.skip_gps = false;
|
||||
},
|
||||
child: Text("Back"),
|
||||
@ -221,7 +220,7 @@ class NotAtGoal extends StatelessWidget {
|
||||
SizedBox(height: 40.0,),
|
||||
ElevatedButton(
|
||||
onPressed: (){
|
||||
Get.off(AppPages.TRAVEL);
|
||||
Get.back();
|
||||
destinationController.skip_gps = false;
|
||||
},
|
||||
child: Text("Back"),
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -193,6 +193,7 @@ class DestnationPage extends StatelessWidget {
|
||||
if(destinationController.is_gps_selected.value){
|
||||
destinationController.chekcs = 0;
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.resetRogaining();
|
||||
}
|
||||
},
|
||||
isSelected: [destinationController.is_gps_selected.value],
|
||||
|
||||
Reference in New Issue
Block a user