fixed state
This commit is contained in:
@ -1,9 +1,11 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/main.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
|
||||
class DestinationBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.put<DestinationController>(DestinationController());
|
||||
restoreGame();
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/main.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/camera/camera_page.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
@ -109,9 +110,10 @@ class DestinationController extends GetxController {
|
||||
|
||||
void startTimerLocation(GeoJsonFeature fs, double distance) {
|
||||
print("---- in startTimer ----");
|
||||
print("---- is in rog is ${is_in_rog} ----");
|
||||
//skip_gps = true;
|
||||
double checkinRadious = fs.properties!['checkin_radius'] ?? double.infinity;
|
||||
if (checkinRadious >= distance) {
|
||||
//if (checkinRadious >= distance) {
|
||||
indexController.currentFeature.clear();
|
||||
Destination d = festuretoDestination(fs);
|
||||
print("----- destination lenght is ${destinations.length} -----");
|
||||
@ -124,7 +126,7 @@ class DestinationController extends GetxController {
|
||||
indexController.currentFeature.add(fs);
|
||||
print("---- before calling startTimer ----");
|
||||
startTimer(d, distance);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
void startTimer(Destination d, double distance) async {
|
||||
@ -337,6 +339,8 @@ class DestinationController extends GetxController {
|
||||
is_gps_selected.value = true;
|
||||
skip_gps = false;
|
||||
|
||||
saveGameState();
|
||||
|
||||
_start = 0;
|
||||
chekcs = 0;
|
||||
rogaining_counted.value = false;
|
||||
@ -365,13 +369,16 @@ class DestinationController extends GetxController {
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => CameraCamera(
|
||||
resolutionPreset: ResolutionPreset.medium,
|
||||
onFile: (file) {
|
||||
photos.add(file);
|
||||
Navigator.pop(context);
|
||||
print("----image file is : $file----");
|
||||
//setState(() {});
|
||||
},
|
||||
)));
|
||||
)
|
||||
|
||||
));
|
||||
}
|
||||
|
||||
void getRoutePoints() {
|
||||
@ -408,6 +415,7 @@ class DestinationController extends GetxController {
|
||||
} else {
|
||||
print("--- hidden loc ${d.hidden_location} ----");
|
||||
// ask for checkin
|
||||
print("is rog ---- ${is_in_rog.value} ----");
|
||||
if (d.hidden_location != null &&
|
||||
d.hidden_location == 0 &&
|
||||
is_in_rog.value == true &&
|
||||
@ -425,7 +433,7 @@ class DestinationController extends GetxController {
|
||||
destination: d,
|
||||
))).whenComplete(() {
|
||||
skip_gps = false;
|
||||
rogaining_counted.value = true;
|
||||
//rogaining_counted.value = true;
|
||||
chekcs = 0;
|
||||
is_in_checkin.value = false;
|
||||
});
|
||||
@ -497,6 +505,8 @@ class DestinationController extends GetxController {
|
||||
makeCheckin(df, true, "");
|
||||
}
|
||||
is_in_rog.value = true;
|
||||
|
||||
saveGameState();
|
||||
}
|
||||
|
||||
void makeCheckin(
|
||||
@ -514,7 +524,7 @@ class DestinationController extends GetxController {
|
||||
|
||||
await GallerySaver.saveImage(imageurl);
|
||||
|
||||
PopulateDestinations();
|
||||
//PopulateDestinations();
|
||||
|
||||
/// post to NATNAT
|
||||
if (indexController.currentUser.isNotEmpty) {
|
||||
@ -622,6 +632,8 @@ class DestinationController extends GetxController {
|
||||
// Start a new timer that fires every 3 seconds
|
||||
_timer = Timer.periodic(Duration(seconds: 3), (timer) async {
|
||||
Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
|
||||
current_lat = position.latitude;
|
||||
current_lon = position.longitude;
|
||||
|
||||
if (is_gps_selected.value) {
|
||||
double czoom = indexController.rogMapController.zoom;
|
||||
|
||||
Reference in New Issue
Block a user