diff --git a/lib/pages/destination/destination_controller.dart b/lib/pages/destination/destination_controller.dart index ddd4808..02c7034 100644 --- a/lib/pages/destination/destination_controller.dart +++ b/lib/pages/destination/destination_controller.dart @@ -668,6 +668,24 @@ class DestinationController extends GetxController { super.onInit(); } + double distanceToStart() { + Destination? ds; + for (Destination d in destinations) { + if (d.cp == -1) { + ds = d; + } + } + + double distanceToDest = double.infinity; + if (ds != null) { + var distance = const Distance(); + distanceToDest = distance.as(LengthUnit.Meter, + LatLng(currentLat, currentLon), LatLng(ds.lat!, ds.lon!)); + } + print("==== dist==${distanceToDest}"); + return distanceToDest; + } + int getForcedChckinDistance(Destination dest) { int _retValue = 100; if (dest.cp == -1) { diff --git a/lib/widgets/bottom_sheet_new.dart b/lib/widgets/bottom_sheet_new.dart index dd14b85..97a5955 100644 --- a/lib/widgets/bottom_sheet_new.dart +++ b/lib/widgets/bottom_sheet_new.dart @@ -481,10 +481,10 @@ class BottomSheetNew extends GetView { // : Container(), // ), Obx( - () => destinationController.isAtGoal.value == true && - destinationController - .rogainingCounted.value == - true + () => destinationController.rogainingCounted.value == + true && + destination.cp == -1 && + destinationController.distanceToStart() <= 500 ? ElevatedButton( onPressed: () { Get.toNamed(AppPages.CAMERA_PAGE); @@ -553,8 +553,12 @@ class BottomSheetNew extends GetView { // forced start / checkin distanceToDest <= - destinationController - .getForcedChckinDistance(destination) + destinationController + .getForcedChckinDistance(destination) && + destinationController.isInCheckin.value == + true && + destinationController.rogainingCounted.value == + false ? ElevatedButton( style: ElevatedButton.styleFrom( backgroundColor: Theme.of(context)