diff --git a/lib/pages/camera/camera_page.dart b/lib/pages/camera/camera_page.dart index ee43387..7f88415 100644 --- a/lib/pages/camera/camera_page.dart +++ b/lib/pages/camera/camera_page.dart @@ -238,15 +238,21 @@ class CameraPage extends StatelessWidget { onPressed: () async { await destinationController.makeCheckin(destination, true, destinationController.photos[0].path); - Get.back(); + //Get.back(); destinationController.rogainingCounted.value = true; destinationController.skipGps = false; destinationController.isPhotoShoot.value = false; + Get.snackbar("チェックインしました。", "${destination.sub_loc_id} : ${destination.name}", backgroundColor: Colors.green, - colorText: Colors.white + colorText: Colors.white, + duration: const Duration(seconds: 2), // 表示時間を1秒に設定 ); + // SnackBarの表示が終了するのを待ってからCameraPageを閉じる + await Future.delayed(const Duration(seconds: 2)); + + Navigator.of(context).pop(true); // ここを修正 }, child: const Text("チェックイン")) : Container()) @@ -371,6 +377,7 @@ class CameraPage extends StatelessWidget { backgroundColor: Colors.green, colorText: Colors.white ); + Navigator.of(context).pop(true); // ここを修正 }, child: const Text("レシートの写真を撮ってください")) : Container()) @@ -438,17 +445,24 @@ class CameraPage extends StatelessWidget { indexController.currentDestinationFeature[0], true, destinationController.photos[0].path); - Get.back(); + //Get.back(); destinationController.rogainingCounted.value = true; destinationController.skipGps = false; destinationController.isPhotoShoot.value = false; + + Get.snackbar( "チェックインしました", indexController.currentDestinationFeature[0].name ?? "", backgroundColor: Colors.green, - colorText: Colors.white + colorText: Colors.white, + duration: const Duration(seconds: 2), // 表示時間を1秒に設定 ); + // SnackBarの表示が終了するのを待ってからCameraPageを閉じる + await Future.delayed(const Duration(seconds: 2)); + + Navigator.of(context).pop(true); // ここを修正 }, child: const Text("チェックイン")) : Container()) diff --git a/lib/pages/destination/destination_controller.dart b/lib/pages/destination/destination_controller.dart index 51b2361..51f0ddb 100644 --- a/lib/pages/destination/destination_controller.dart +++ b/lib/pages/destination/destination_controller.dart @@ -798,8 +798,76 @@ class DestinationController extends GetxController { isInRog.value == true && d.cp != -1 && d.cp != 0 && d.cp != -2) { chekcs = 3; - isInCheckin.value = true; photos.clear(); + isInCheckin.value = true; + + final result = await showModalBottomSheet( + constraints: + BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), + context: Get.context!, + isScrollControlled: true, + builder: ((context) => CameraPage( + manulaCheckin: true, + destination: d, + ))); + + if (result ?? false) { + debugPrint("==> Checkin complete...."); + if (d.buy_point != null && d.buy_point! > 0) { + skipGps = true; + photos.clear(); + DatabaseHelper db = DatabaseHelper.instance; + List ds = + await db.getDestinationByLatLon(d.lat!, d.lon!); + Destination? dss; + if (ds.isNotEmpty) { + dss = ds.first; + } + + await showModalBottomSheet( + constraints: + BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), + context: Get.context!, + isScrollControlled: true, + builder: ((context) => + CameraPage( + buyPointPhoto: true, + destination: d, + dbDest: dss, + ))).whenComplete(() { + skipGps = false; + rogainingCounted.value = true; + chekcs = 0; + isInCheckin.value = false; + //Get.back(); + }); + } + } else { + debugPrint("キャンセルされました"); + Get.snackbar( + "キャンセルされました", + "チェックインしていません。必要ならもう一度チェックポイントをタップして下さい。", + backgroundColor: Colors.yellow, + colorText: Colors.black, + icon: const Icon( + Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), + snackPosition: SnackPosition.TOP, + duration: const Duration(seconds: 3), + ); + } + } else { + Get.snackbar( + "ロゲが始まっていません", + "ロゲ開始ボタンをタップして、ロゲイニングを始める必要があります", + backgroundColor: Colors.yellow, + colorText: Colors.black, + icon: const Icon( + Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), + snackPosition: SnackPosition.TOP, + duration: const Duration(seconds: 3), + ); + } + /* await showModalBottomSheet( constraints: BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), @@ -814,7 +882,7 @@ class DestinationController extends GetxController { photos.clear(); DatabaseHelper db = DatabaseHelper.instance; List ds = - await db.getDestinationByLatLon(d.lat!, d.lon!); + await db.getDestinationByLatLon(d.lat!, d.lon!); Destination? dss; if (ds.isNotEmpty) { dss = ds.first; @@ -822,14 +890,14 @@ class DestinationController extends GetxController { await showModalBottomSheet( constraints: - BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), + BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), context: Get.context!, isScrollControlled: true, builder: ((context) => CameraPage( - buyPointPhoto: true, - destination: d, - dbDest: dss, - ))).whenComplete(() { + buyPointPhoto: true, + destination: d, + dbDest: dss, + ))).whenComplete(() { skipGps = false; rogainingCounted.value = true; chekcs = 0; @@ -855,6 +923,8 @@ class DestinationController extends GetxController { // backgroundColor: Colors.yellow, ); } + */ + } }