From 9145e0e27d0b0c3f2ec9ec685731d4b82e6e8a51 Mon Sep 17 00:00:00 2001 From: Mohamed Nouffer Date: Mon, 18 Dec 2023 09:22:18 +0530 Subject: [PATCH] fixed multi popup on camera page --- ios/Podfile.lock | 16 +- .../destination/destination_controller.dart | 231 ++++++++++-------- 2 files changed, 142 insertions(+), 105 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index f28bf97..c729f5c 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -12,10 +12,10 @@ PODS: - FMDB (2.7.5): - FMDB/standard (= 2.7.5) - FMDB/standard (2.7.5) - - gallery_saver (0.0.1): - - Flutter - geolocator_apple (1.2.0): - Flutter + - image_gallery_saver (2.0.2): + - Flutter - image_picker_ios (0.0.1): - Flutter - isar_flutter_libs (1.0.0): @@ -41,8 +41,8 @@ DEPENDENCIES: - Flutter (from `Flutter`) - flutter_compass (from `.symlinks/plugins/flutter_compass/ios`) - flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`) - - gallery_saver (from `.symlinks/plugins/gallery_saver/ios`) - geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`) + - image_gallery_saver (from `.symlinks/plugins/image_gallery_saver/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - isar_flutter_libs (from `.symlinks/plugins/isar_flutter_libs/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) @@ -67,10 +67,10 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_compass/ios" flutter_keyboard_visibility: :path: ".symlinks/plugins/flutter_keyboard_visibility/ios" - gallery_saver: - :path: ".symlinks/plugins/gallery_saver/ios" geolocator_apple: :path: ".symlinks/plugins/geolocator_apple/ios" + image_gallery_saver: + :path: ".symlinks/plugins/image_gallery_saver/ios" image_picker_ios: :path: ".symlinks/plugins/image_picker_ios/ios" isar_flutter_libs: @@ -88,13 +88,13 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb - connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a + connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 flutter_compass: cbbd285cea1584c7ac9c4e0c3e1f17cbea55e855 flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a - gallery_saver: 9fc173c9f4fcc48af53b2a9ebea1b643255be542 geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401 + image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5 isar_flutter_libs: b69f437aeab9c521821c3f376198c4371fa21073 path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 @@ -102,7 +102,7 @@ SPEC CHECKSUMS: ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a - url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4 + url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b PODFILE CHECKSUM: a1c2f8dde3796ecc1697a15e7c75eb5205d8a740 diff --git a/lib/pages/destination/destination_controller.dart b/lib/pages/destination/destination_controller.dart index e70359d..9035ff1 100644 --- a/lib/pages/destination/destination_controller.dart +++ b/lib/pages/destination/destination_controller.dart @@ -42,6 +42,8 @@ class DestinationController extends GetxController { double currentLon = 0.0; DateTime lastGPSCollectedTime = DateTime.now(); + bool shouldShowBottomSheet = true; + static bool gps_push_started = false; static bool game_started = false; @@ -173,15 +175,21 @@ class DestinationController extends GetxController { if (isPhotoShoot.value == true) { photos.clear(); - await showModalBottomSheet( - constraints: BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), - context: Get.context!, - isScrollControlled: true, - builder: ((context) => CameraPage(destination: d))).whenComplete(() { - skipGps = false; - chekcs = 0; - isInCheckin.value = false; - }); + if (shouldShowBottomSheet) { + shouldShowBottomSheet = false; + await showModalBottomSheet( + constraints: + BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), + context: Get.context!, + isScrollControlled: true, + builder: ((context) => CameraPage(destination: d))) + .whenComplete(() { + shouldShowBottomSheet = true; + skipGps = false; + chekcs = 0; + isInCheckin.value = false; + }); + } return; } @@ -195,36 +203,44 @@ class DestinationController extends GetxController { chekcs = 1; isInCheckin.value = true; isAtStart.value = true; - await showModalBottomSheet( - constraints: - BoxConstraints.loose(Size(Get.width, Get.height * 0.85)), - context: Get.context!, - isScrollControlled: true, - builder: ((context) => BottomSheetNew( - destination: d, - ))).whenComplete(() { - skipGps = false; - chekcs = 0; - isAtStart.value = false; - isInCheckin.value = false; - }); + if (shouldShowBottomSheet) { + shouldShowBottomSheet = false; + await showModalBottomSheet( + constraints: + BoxConstraints.loose(Size(Get.width, Get.height * 0.85)), + context: Get.context!, + isScrollControlled: true, + builder: ((context) => BottomSheetNew( + destination: d, + ))).whenComplete(() { + shouldShowBottomSheet = true; + skipGps = false; + chekcs = 0; + isAtStart.value = false; + isInCheckin.value = false; + }); + } return; } else if (isInRog.value == true && indexController.rogMode.value == 1) { // print("----- in location popup checkin cp - ${d.cp}----"); chekcs = 2; isInCheckin.value = true; - await showModalBottomSheet( - constraints: - BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), - context: Get.context!, - isScrollControlled: true, - builder: ((context) => BottomSheetNew( - destination: d, - ))).whenComplete(() { - skipGps = false; - chekcs = 0; - isInCheckin.value = false; - }); + if (shouldShowBottomSheet) { + shouldShowBottomSheet = false; + await showModalBottomSheet( + constraints: + BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), + context: Get.context!, + isScrollControlled: true, + builder: ((context) => BottomSheetNew( + destination: d, + ))).whenComplete(() { + shouldShowBottomSheet = true; + skipGps = false; + chekcs = 0; + isInCheckin.value = false; + }); + } return; } } @@ -256,34 +272,42 @@ class DestinationController extends GetxController { isInCheckin.value = true; photos.clear(); // print("--- calling checkin ---"); - await showModalBottomSheet( - constraints: - BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), - context: Get.context!, - isScrollControlled: true, - builder: ((context) => CameraPage( - destination: d, - ))).whenComplete(() { - skipGps = false; - rogainingCounted.value = true; - chekcs = 0; - isInCheckin.value = false; - }); + if (shouldShowBottomSheet) { + shouldShowBottomSheet = false; + await showModalBottomSheet( + constraints: + BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), + context: Get.context!, + isScrollControlled: true, + builder: ((context) => CameraPage( + destination: d, + ))).whenComplete(() { + shouldShowBottomSheet = true; + skipGps = false; + rogainingCounted.value = true; + chekcs = 0; + isInCheckin.value = false; + }); + } return; } else if (isInRog.value == true && d.cp != -1) { chekcs = 4; isInCheckin.value = true; - await showMaterialModalBottomSheet( - expand: true, - context: Get.context!, - backgroundColor: Colors.transparent, - builder: (context) => BottomSheetNew( - destination: d, - )).whenComplete(() { - skipGps = false; - chekcs = 0; - isInCheckin.value = false; - }); + if (shouldShowBottomSheet) { + shouldShowBottomSheet = false; + await showMaterialModalBottomSheet( + expand: true, + context: Get.context!, + backgroundColor: Colors.transparent, + builder: (context) => BottomSheetNew( + destination: d, + )).whenComplete(() { + shouldShowBottomSheet = true; + skipGps = false; + chekcs = 0; + isInCheckin.value = false; + }); + } return; } } @@ -298,20 +322,25 @@ class DestinationController extends GetxController { isInCheckin.value = true; photos.clear(); //print("--- open buy point $buyPointImageAdded ${d.buypoint_image} ----"); - 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: ds.first, - ))).whenComplete(() { - skipGps = false; - rogainingCounted.value = true; - chekcs = 0; - isInCheckin.value = false; - }); + if (shouldShowBottomSheet) { + shouldShowBottomSheet = false; + 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: ds.first, + ))).whenComplete(() { + shouldShowBottomSheet = true; + skipGps = false; + rogainingCounted.value = true; + chekcs = 0; + isInCheckin.value = false; + }); + } return; } // print("---- cp --- ${d.cp} -----"); @@ -331,18 +360,22 @@ class DestinationController extends GetxController { chekcs = 5; isAtGoal.value = true; photos.clear(); - await showModalBottomSheet( - constraints: - BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), - context: Get.context!, - isScrollControlled: true, - builder: ((context) => CameraPage( - destination: d, - ))).whenComplete(() { - skipGps = false; - chekcs = 0; - isAtGoal.value = false; - }); + if (shouldShowBottomSheet) { + shouldShowBottomSheet = false; + await showModalBottomSheet( + constraints: + BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), + context: Get.context!, + isScrollControlled: true, + builder: ((context) => CameraPage( + destination: d, + ))).whenComplete(() { + shouldShowBottomSheet = true; + skipGps = false; + chekcs = 0; + isAtGoal.value = false; + }); + } return; } else if (isInRog.value == false && indexController.rogMode.value == 1 && @@ -351,19 +384,23 @@ class DestinationController extends GetxController { //print("---- in start -----"); chekcs = 6; isAtStart.value = true; - await showModalBottomSheet( - constraints: - BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), - context: Get.context!, - isScrollControlled: true, - builder: ((context) => BottomSheetNew( - destination: d, - ))).whenComplete(() { - //print("----- finished start -------"); - skipGps = false; - chekcs = 0; - isAtStart.value = false; - }); + if (shouldShowBottomSheet) { + shouldShowBottomSheet = false; + await showModalBottomSheet( + constraints: + BoxConstraints.loose(Size(Get.width, Get.height * 0.75)), + context: Get.context!, + isScrollControlled: true, + builder: ((context) => BottomSheetNew( + destination: d, + ))).whenComplete(() { + shouldShowBottomSheet = true; + //print("----- finished start -------"); + skipGps = false; + chekcs = 0; + isAtStart.value = false; + }); + } return; } }