update goal condition for more that 1000 m away
This commit is contained in:
@ -15,6 +15,7 @@ void saveGameState() async {
|
||||
pref.setBool("is_in_rog", destinationController.isInRog.value);
|
||||
pref.setBool(
|
||||
"rogaining_counted", destinationController.rogainingCounted.value);
|
||||
pref.setBool("ready_for_goal", DestinationController.ready_for_goal);
|
||||
}
|
||||
|
||||
void restoreGame() async {
|
||||
@ -25,6 +26,8 @@ void restoreGame() async {
|
||||
destinationController.isInRog.value = pref.getBool("is_in_rog") ?? false;
|
||||
destinationController.rogainingCounted.value =
|
||||
pref.getBool("rogaining_counted") ?? false;
|
||||
DestinationController.ready_for_goal =
|
||||
pref.getBool("ready_for_goal") ?? false;
|
||||
//print(
|
||||
// "--restored -- destinationController.isInRog.value ${pref.getBool("is_in_rog")} -- ${pref.getBool("rogaining_counted")}");
|
||||
}
|
||||
|
||||
@ -46,6 +46,7 @@ class DestinationController extends GetxController {
|
||||
|
||||
static bool gps_push_started = false;
|
||||
static bool game_started = false;
|
||||
static bool ready_for_goal = false;
|
||||
|
||||
bool skip_10s = false;
|
||||
|
||||
@ -420,6 +421,7 @@ class DestinationController extends GetxController {
|
||||
isAtGoal.value = false;
|
||||
isGpsSelected.value = true;
|
||||
skipGps = false;
|
||||
ready_for_goal = false;
|
||||
|
||||
_start = 0;
|
||||
chekcs = 0;
|
||||
@ -744,6 +746,10 @@ class DestinationController extends GetxController {
|
||||
|
||||
void handleLocationUpdate(Position? position) async {
|
||||
if (position != null) {
|
||||
if (distanceToStart() >= 1000) {
|
||||
ready_for_goal = true;
|
||||
}
|
||||
|
||||
var distance = const Distance();
|
||||
double distanceToDest = distance.as(
|
||||
LengthUnit.Meter,
|
||||
|
||||
@ -508,7 +508,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
destinationController.rogainingCounted.value == true &&
|
||||
destinationController.distanceToStart() <=
|
||||
500 &&
|
||||
destination.cp == -1
|
||||
destination.cp == -1 &&
|
||||
DestinationController.ready_for_goal == true
|
||||
? ElevatedButton(
|
||||
onPressed: () async {
|
||||
destinationController.isAtGoal.value = true;
|
||||
|
||||
Reference in New Issue
Block a user