diff --git a/lib/pages/destination/destination_controller.dart b/lib/pages/destination/destination_controller.dart index def4063..34e518d 100644 --- a/lib/pages/destination/destination_controller.dart +++ b/lib/pages/destination/destination_controller.dart @@ -485,6 +485,7 @@ class DestinationController extends GetxController { rogainingCounted.value = true; chekcs = 0; isInCheckin.value = false; + Get.back(); }); } else { skipGps = false; diff --git a/lib/widgets/bottom_sheet_new.dart b/lib/widgets/bottom_sheet_new.dart index 93682cf..46b0f66 100644 --- a/lib/widgets/bottom_sheet_new.dart +++ b/lib/widgets/bottom_sheet_new.dart @@ -600,51 +600,64 @@ class BottomSheetNew extends GetView { ), // forced start / checkin - distanceToDest <= - destinationController - .getForcedChckinDistance(destination) && - destinationController.isInRog.value == false && - // destinationController.isInCheckin.value == - // true && - destinationController.rogainingCounted.value == - false - ? ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: Theme.of(context) - .colorScheme - .secondary), - onPressed: () async { - //print("~~~~ manual checkin button ~~~~"); - if (destination.cp == -1) { - destinationController.isInRog.value = true; - destinationController.addToRogaining( - destinationController.currentLat, - destinationController.currentLon, - destination.location_id!); - saveGameState(); - ExternalService() - .startRogaining() - .then((value) => Get.back()); - } else { - await destinationController - .callforCheckin(destination); - } - }, - child: Text( - destinationController - .festuretoDestination( - indexController - .currentFeature[0]) - .cp == - -1 - ? "ロゲ開始" - : "チェックイン", - style: TextStyle( - color: Theme.of(context) - .colorScheme - .onSecondary))) - : ElevatedButton( - onPressed: () {}, child: const Text("ゲーム中")), + Obx( + () => distanceToDest <= + destinationController + .getForcedChckinDistance(destination) + ? ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: Theme.of(context) + .colorScheme + .secondary), + onPressed: () async { + //print("~~~~ manual checkin button ~~~~"); + if (destination.cp == -1 && + destinationController.isInRog.value == + false && + destinationController + .rogainingCounted.value == + false) { + destinationController.isInRog.value = + true; + destinationController.addToRogaining( + destinationController.currentLat, + destinationController.currentLon, + destination.location_id!); + saveGameState(); + ExternalService() + .startRogaining() + .then((value) => Get.back()); + } else { + Get.back(); + await destinationController + .callforCheckin(destination); + } + }, + child: Text( + destination.cp == -1 && + destinationController + .isInRog.value == + false && + destinationController + .rogainingCounted.value == + false + ? "ロゲ開始" + : destinationController + .isInRog.value == + true && + destination.cp == -1 + ? "ゲーム中" + : isAlreadyCheckedIn == true + ? "ゲーム中" + : "チェックイン", + style: TextStyle( + color: Theme.of(context) + .colorScheme + .onSecondary))) + : Container(), + ) + // ElevatedButton( + // onPressed: () {}, child: const Text("ゲーム中")), ], ), Row(