From 4f2ccf6495cd8c04dc6979141343e806b161acc5 Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Thu, 2 May 2024 15:01:01 +0300 Subject: [PATCH] 5/2/passnew --- android/app/build.gradle | 6 +- android/app/src/main/AndroidManifest.xml | 1 - ios/Podfile.lock | 70 -- key/api_key.json | 14 - .../admin/captain_admin_controller.dart | 109 -- .../admin/passenger_admin_controller.dart | 110 -- .../admin/ride_admin_controller.dart | 73 -- .../admin/wallet_admin_controller.dart | 20 - .../auth/captin/history_captain.dart | 62 -- .../auth/captin/login_captin_controller.dart | 118 --- lib/controller/auth/captin/ml_google_doc.dart | 103 -- .../captin/register_captin_controller.dart | 197 ---- lib/controller/auth/google_sign.dart | 4 +- lib/controller/auth/login_controller.dart | 66 +- lib/controller/firebase/firbase_messge.dart | 79 +- lib/controller/functions/call_controller.dart | 33 +- .../functions/camer_controller.dart | 245 ----- lib/controller/functions/crud.dart | 5 +- .../functions/document_scanner.dart | 41 - lib/controller/functions/gemeni.dart | 928 ----------------- lib/controller/functions/llama_ai.dart | 44 - .../functions/location_controller.dart | 56 +- lib/controller/functions/ocr_controller.dart | 673 ------------ .../home/captin/duration_controller .dart | 76 -- .../home/captin/help/help_controller.dart | 95 -- .../home/captin/home_captain_controller.dart | 332 ------ .../home/captin/map_driver_controller.dart | 904 ---------------- .../home/captin/order_request_controller.dart | 178 ---- .../home/splash_screen_controlle.dart | 8 +- lib/controller/rate/rate_conroller.dart | 75 +- lib/main.dart | 22 +- lib/views/Rate/rate_passenger.dart | 195 ---- lib/views/Rate/ride_calculate_driver.dart | 212 ---- lib/views/admin/admin_home_page.dart | 111 -- lib/views/admin/captain/captain.dart | 223 ---- lib/views/admin/captain/captain_details.dart | 168 --- lib/views/admin/captain/form_captain.dart | 86 -- lib/views/admin/passenger/form_passenger.dart | 86 -- lib/views/admin/passenger/passenger.dart | 206 ---- .../passenger/passenger_details_page.dart | 168 --- lib/views/admin/rides/rides.dart | 237 ----- lib/views/admin/static/static.dart | 12 - lib/views/admin/wallet/wallet.dart | 15 - lib/views/auth/captin/ai_page.dart | 979 ------------------ .../camera_widgets/camera_lisence_page.dart | 83 -- lib/views/auth/captin/car_license_page.dart | 170 --- lib/views/auth/captin/forget.dart | 0 lib/views/auth/captin/login_captin.dart | 323 ------ lib/views/auth/captin/logout_captain.dart | 42 - lib/views/auth/captin/register_captin.dart | 167 --- .../auth/captin/verify_email_captain.dart | 91 -- lib/views/auth/login_page.dart | 87 +- lib/views/home/Captin/bottom_bar.dart | 119 --- lib/views/home/Captin/camer_widget.dart | 305 ------ lib/views/home/Captin/driver_map_page.dart | 87 -- .../home/Captin/history/history_captain.dart | 107 -- .../Captin/history/history_details_page.dart | 205 ---- .../Captin/home_captain/drawer_captain.dart | 222 ---- .../Captin/home_captain/driver_call_page.dart | 194 ---- .../Captin/home_captain/help_captain.dart | 155 --- .../help_details_replay_page.dart | 82 -- .../home/Captin/home_captain/home_captin.dart | 298 ------ .../Captin/home_captain/widget/call_page.dart | 98 -- .../widget/call_page_From_passenger.dart | 116 --- .../Captin/home_captain/widget/connect.dart | 103 -- .../widget/left_menu_map_captain.dart | 137 --- .../home_captain/widget/zones_controller.dart | 73 -- .../mapDriverWidgets/driver_end_ride_bar.dart | 255 ----- .../google_driver_map_page.dart | 97 -- .../mapDriverWidgets/google_map_app.dart | 54 - .../passenger_info_window.dart | 421 -------- .../Captin/mapDriverWidgets/sos_connect.dart | 117 --- lib/views/home/Captin/orderCaptin/call.dart | 25 - .../orderCaptin/order_request_page.dart | 435 -------- .../orderCaptin/order_speed_request.dart | 464 --------- lib/views/home/Captin/passportimage.dart | 46 - lib/views/home/Captin/settings_captain.dart | 90 -- lib/views/home/Captin/text_scanner.dart | 175 ---- .../map_widget.dart/apply_order_widget.dart | 3 +- .../home/map_widget.dart/map_menu_widget.dart | 4 +- .../points_page_for_rider.dart | 9 +- lib/views/home/profile/order_history.dart | 1 - .../notification/available_rides_page.dart | 265 ----- pubspec.lock | 42 +- pubspec.yaml | 4 - t dataBounds = [] | 344 ------ 86 files changed, 130 insertions(+), 13430 deletions(-) delete mode 100644 key/api_key.json delete mode 100644 lib/controller/admin/captain_admin_controller.dart delete mode 100644 lib/controller/admin/passenger_admin_controller.dart delete mode 100644 lib/controller/admin/ride_admin_controller.dart delete mode 100644 lib/controller/admin/wallet_admin_controller.dart delete mode 100644 lib/controller/auth/captin/history_captain.dart delete mode 100644 lib/controller/auth/captin/login_captin_controller.dart delete mode 100644 lib/controller/auth/captin/ml_google_doc.dart delete mode 100644 lib/controller/auth/captin/register_captin_controller.dart delete mode 100644 lib/controller/functions/camer_controller.dart delete mode 100644 lib/controller/functions/document_scanner.dart delete mode 100644 lib/controller/functions/gemeni.dart delete mode 100644 lib/controller/functions/llama_ai.dart delete mode 100644 lib/controller/functions/ocr_controller.dart delete mode 100644 lib/controller/home/captin/duration_controller .dart delete mode 100644 lib/controller/home/captin/help/help_controller.dart delete mode 100644 lib/controller/home/captin/home_captain_controller.dart delete mode 100644 lib/controller/home/captin/map_driver_controller.dart delete mode 100644 lib/controller/home/captin/order_request_controller.dart delete mode 100644 lib/views/Rate/rate_passenger.dart delete mode 100644 lib/views/Rate/ride_calculate_driver.dart delete mode 100644 lib/views/admin/admin_home_page.dart delete mode 100644 lib/views/admin/captain/captain.dart delete mode 100644 lib/views/admin/captain/captain_details.dart delete mode 100644 lib/views/admin/captain/form_captain.dart delete mode 100644 lib/views/admin/passenger/form_passenger.dart delete mode 100644 lib/views/admin/passenger/passenger.dart delete mode 100644 lib/views/admin/passenger/passenger_details_page.dart delete mode 100644 lib/views/admin/rides/rides.dart delete mode 100644 lib/views/admin/static/static.dart delete mode 100644 lib/views/admin/wallet/wallet.dart delete mode 100644 lib/views/auth/captin/ai_page.dart delete mode 100644 lib/views/auth/captin/camera_widgets/camera_lisence_page.dart delete mode 100644 lib/views/auth/captin/car_license_page.dart delete mode 100644 lib/views/auth/captin/forget.dart delete mode 100644 lib/views/auth/captin/login_captin.dart delete mode 100644 lib/views/auth/captin/logout_captain.dart delete mode 100644 lib/views/auth/captin/register_captin.dart delete mode 100644 lib/views/auth/captin/verify_email_captain.dart delete mode 100644 lib/views/home/Captin/bottom_bar.dart delete mode 100644 lib/views/home/Captin/camer_widget.dart delete mode 100644 lib/views/home/Captin/driver_map_page.dart delete mode 100644 lib/views/home/Captin/history/history_captain.dart delete mode 100644 lib/views/home/Captin/history/history_details_page.dart delete mode 100644 lib/views/home/Captin/home_captain/drawer_captain.dart delete mode 100644 lib/views/home/Captin/home_captain/driver_call_page.dart delete mode 100644 lib/views/home/Captin/home_captain/help_captain.dart delete mode 100644 lib/views/home/Captin/home_captain/help_details_replay_page.dart delete mode 100644 lib/views/home/Captin/home_captain/home_captin.dart delete mode 100644 lib/views/home/Captin/home_captain/widget/call_page.dart delete mode 100644 lib/views/home/Captin/home_captain/widget/call_page_From_passenger.dart delete mode 100644 lib/views/home/Captin/home_captain/widget/connect.dart delete mode 100644 lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart delete mode 100644 lib/views/home/Captin/home_captain/widget/zones_controller.dart delete mode 100644 lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart delete mode 100644 lib/views/home/Captin/mapDriverWidgets/google_driver_map_page.dart delete mode 100644 lib/views/home/Captin/mapDriverWidgets/google_map_app.dart delete mode 100644 lib/views/home/Captin/mapDriverWidgets/passenger_info_window.dart delete mode 100644 lib/views/home/Captin/mapDriverWidgets/sos_connect.dart delete mode 100644 lib/views/home/Captin/orderCaptin/call.dart delete mode 100644 lib/views/home/Captin/orderCaptin/order_request_page.dart delete mode 100644 lib/views/home/Captin/orderCaptin/order_speed_request.dart delete mode 100644 lib/views/home/Captin/passportimage.dart delete mode 100644 lib/views/home/Captin/settings_captain.dart delete mode 100644 lib/views/home/Captin/text_scanner.dart delete mode 100644 lib/views/notification/available_rides_page.dart delete mode 100644 t dataBounds = [] diff --git a/android/app/build.gradle b/android/app/build.gradle index d16ca8c..7235d74 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -53,10 +53,10 @@ android { applicationId "com.mobileapp.store.ride" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. - minSdkVersion 26 + minSdkVersion 22 targetSdkVersion flutter.targetSdkVersion - versionCode 21 - versionName '1.4.5' + versionCode 22 + versionName '1.4.6' // manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml'] } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 89ece84..b667beb 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -6,7 +6,6 @@ - diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 0cf9f2b..2aba9a2 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -43,8 +43,6 @@ PODS: - AppAuth/Core - audio_session (0.0.1): - Flutter - - background_location (0.0.1): - - Flutter - camera_avfoundation (0.0.1): - Flutter - device_info_plus (0.0.1): @@ -96,13 +94,6 @@ PODS: - google_maps_flutter_ios (0.0.1): - Flutter - GoogleMaps (< 9.0) - - google_mlkit_commons (0.7.1): - - Flutter - - MLKitVision - - google_mlkit_text_recognition (0.13.0): - - Flutter - - google_mlkit_commons - - GoogleMLKit/TextRecognition (~> 6.0.0) - google_sign_in_ios (0.0.1): - AppAuth (>= 1.7.4) - Flutter @@ -118,20 +109,10 @@ PODS: - GoogleMaps/Base (7.4.0) - GoogleMaps/Maps (7.4.0): - GoogleMaps/Base - - GoogleMLKit/MLKitCore (6.0.0): - - MLKitCommon (~> 11.0.0) - - GoogleMLKit/TextRecognition (6.0.0): - - GoogleMLKit/MLKitCore - - MLKitTextRecognition (~> 4.0.0) - GoogleSignIn (7.1.0): - AppAuth (< 2.0, >= 1.7.3) - GTMAppAuth (< 5.0, >= 4.1.1) - GTMSessionFetcher/Core (~> 3.3) - - GoogleToolboxForMac/Defines (4.2.1) - - GoogleToolboxForMac/Logger (4.2.1): - - GoogleToolboxForMac/Defines (= 4.2.1) - - "GoogleToolboxForMac/NSData+zlib (4.2.1)": - - GoogleToolboxForMac/Defines (= 4.2.1) - GoogleUtilities/AppDelegateSwizzler (7.13.2): - GoogleUtilities/Environment - GoogleUtilities/Logger @@ -157,8 +138,6 @@ PODS: - GoogleUtilities/UserDefaults (7.13.2): - GoogleUtilities/Logger - GoogleUtilities/Privacy - - GoogleUtilitiesComponents (1.1.0): - - GoogleUtilities/Logger - GTMAppAuth (4.1.1): - AppAuth/Core (~> 1.7) - GTMSessionFetcher/Core (< 4.0, >= 3.3) @@ -180,27 +159,6 @@ PODS: - Flutter - location (0.0.1): - Flutter - - MLImage (1.0.0-beta5) - - MLKitCommon (11.0.0): - - GoogleDataTransport (< 10.0, >= 9.4.1) - - GoogleToolboxForMac/Logger (< 5.0, >= 4.2.1) - - "GoogleToolboxForMac/NSData+zlib (< 5.0, >= 4.2.1)" - - GoogleUtilities/UserDefaults (< 8.0, >= 7.13.0) - - GoogleUtilitiesComponents (~> 1.0) - - GTMSessionFetcher/Core (< 4.0, >= 3.3.2) - - MLKitTextRecognition (4.0.0): - - MLKitCommon (~> 11.0) - - MLKitTextRecognitionCommon (= 3.0.0) - - MLKitVision (~> 7.0) - - MLKitTextRecognitionCommon (3.0.0): - - MLKitCommon (~> 11.0) - - MLKitVision (~> 7.0) - - MLKitVision (7.0.0): - - GoogleToolboxForMac/Logger (< 5.0, >= 4.2.1) - - "GoogleToolboxForMac/NSData+zlib (< 5.0, >= 4.2.1)" - - GTMSessionFetcher/Core (< 4.0, >= 3.3.2) - - MLImage (= 1.0.0-beta5) - - MLKitCommon (~> 11.0) - nanopb (2.30909.1): - nanopb/decode (= 2.30909.1) - nanopb/encode (= 2.30909.1) @@ -274,7 +232,6 @@ PODS: DEPENDENCIES: - agora_rtc_engine (from `.symlinks/plugins/agora_rtc_engine/ios`) - audio_session (from `.symlinks/plugins/audio_session/ios`) - - background_location (from `.symlinks/plugins/background_location/ios`) - camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`) - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) - firebase_core (from `.symlinks/plugins/firebase_core/ios`) @@ -285,8 +242,6 @@ DEPENDENCIES: - flutter_tts (from `.symlinks/plugins/flutter_tts/ios`) - geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`) - google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`) - - google_mlkit_commons (from `.symlinks/plugins/google_mlkit_commons/ios`) - - google_mlkit_text_recognition (from `.symlinks/plugins/google_mlkit_text_recognition/ios`) - google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`) - image_cropper (from `.symlinks/plugins/image_cropper/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) @@ -320,18 +275,10 @@ SPEC REPOS: - FMDB - GoogleDataTransport - GoogleMaps - - GoogleMLKit - GoogleSignIn - - GoogleToolboxForMac - GoogleUtilities - - GoogleUtilitiesComponents - GTMAppAuth - GTMSessionFetcher - - MLImage - - MLKitCommon - - MLKitTextRecognition - - MLKitTextRecognitionCommon - - MLKitVision - nanopb - PromisesObjC - Stripe @@ -349,8 +296,6 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/agora_rtc_engine/ios" audio_session: :path: ".symlinks/plugins/audio_session/ios" - background_location: - :path: ".symlinks/plugins/background_location/ios" camera_avfoundation: :path: ".symlinks/plugins/camera_avfoundation/ios" device_info_plus: @@ -371,10 +316,6 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/geolocator_apple/ios" google_maps_flutter_ios: :path: ".symlinks/plugins/google_maps_flutter_ios/ios" - google_mlkit_commons: - :path: ".symlinks/plugins/google_mlkit_commons/ios" - google_mlkit_text_recognition: - :path: ".symlinks/plugins/google_mlkit_text_recognition/ios" google_sign_in_ios: :path: ".symlinks/plugins/google_sign_in_ios/darwin" image_cropper: @@ -420,7 +361,6 @@ SPEC CHECKSUMS: AgoraRtcEngine_iOS: 267c0980c1fb97e056d05b850f8629b05b6e467a AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa audio_session: 4f3e461722055d21515cf3261b64c973c062f345 - background_location: 1b80c1fe3abd9912bca298618f6e365abf6f588f camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6 Firebase: 414ad272f8d02dfbf12662a9d43f4bba9bec2a06 @@ -437,16 +377,11 @@ SPEC CHECKSUMS: FMDB: eae540775bf7d0c87a5af926ae37af69effe5a19 geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401 google_maps_flutter_ios: 590249c67f34f422122c232f2a626192adbc78ee - google_mlkit_commons: 96aaca445520311b84a2da013dedf3427fe4cc69 - google_mlkit_text_recognition: 393c2526da49aa6c9c883e6d69100f54af011e24 google_sign_in_ios: 07375bfbf2620bc93a602c0e27160d6afc6ead38 GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a GoogleMaps: 032f676450ba0779bd8ce16840690915f84e57ac - GoogleMLKit: 97ac7af399057e99182ee8edfa8249e3226a4065 GoogleSignIn: d4281ab6cf21542b1cfaff85c191f230b399d2db - GoogleToolboxForMac: d1a2cbf009c453f4d6ded37c105e2f67a32206d8 GoogleUtilities: c56430aef51a1aa57b25da78c3f8397e522c67b7 - GoogleUtilitiesComponents: 679b2c881db3b615a2777504623df6122dd20afe GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de GTMSessionFetcher: 8000756fc1c19d2e5697b90311f7832d2e33f6cd image_cropper: a3291c624a953049bc6a02e1f8c8ceb162a24b25 @@ -455,11 +390,6 @@ SPEC CHECKSUMS: just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa local_auth_ios: c6cf091ded637a88f24f86a8875d8b0f526e2605 location: d5cf8598915965547c3f36761ae9cc4f4e87d22e - MLImage: 1824212150da33ef225fbd3dc49f184cf611046c - MLKitCommon: afec63980417d29ffbb4790529a1b0a2291699e1 - MLKitTextRecognition: c83c18ad25496f2077f6ec93c5940487ff2eb343 - MLKitTextRecognitionCommon: c0b3a63d529296a19bce1f8bc8a513644ed4d1f6 - MLKitVision: e858c5f125ecc288e4a31127928301eaba9ae0c1 nanopb: d4d75c12cd1316f4a64e3c6963f879ecd4b5e0d5 package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85 path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 diff --git a/key/api_key.json b/key/api_key.json deleted file mode 100644 index a4a598c..0000000 --- a/key/api_key.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "basicAuthCredentials": "wqnmqqsjyvwv:nqrDEV@2101Br", - "accountSIDTwillo": "ACx4qy857juj0903xuy6238q763q2fj4y1Br", - "serverAPI": "AAAAobYrrCi:APA91xF1zwTvmSzSdaxuY6f60D8mz1ZzyIzr9od6br7GDyeCaWPRK0G0hx5SaFyx1eDvQDpQPdGk-697MWLi0zs3iYInBtBLOxswg0GecNmsl0PxE3wI-vOpwu8Vv1dkUkBniuxZYXgHBr", - "mapAPIKEY": "AImqSsCsutRXTtSTLOFQSQkN5v7QZkGJVZbEKa0Br", - "twilloRecoveryCode": "TQF13XUVU2NJ3VFU8JWBWYBSBr", - "authTokenTwillo": "14u39ju4628xx8q4u18469u462u8qu75Br", - "chatGPTkey": "zg-8T67q8YDNGAeUSXqkHowT3BrxgFJfFy3ELw6rm7A6adb0kjwBr", - "transactionCloude": "Ahcwilomqcoib:API_EMDJX6BHQ67DBGT6WV:DG2XPU7YEN02M0VJ2FBr", - "visionApi": "0vALyaDDYHpmv73Q59SIkxmeG7Z2mgwJXlBr", - "stripe_publishableKe": "vg_cjzc_51O4WTODMEVlOCA5SN5j6x8vApF5CPDC3f3Pou18a74NEQAvU5AunZZEN9X2WIqsuIlUTeeh1vUqpnkijLkx3FR5g00vb4iMHGOBr", - "secretKey": "zg_cjzc_51O4WTODMEVlOCA5SBkqiSS69bNFRsuZd2Tr5ODztYseaLvf0RdBHW3wwfP38Tv78TZ1PQiZi7jHFrrRoQy3lMHPN00Ll9WD3b2Br", - "chatGPTkeySefer": "zg-OiL08ooza0Dvhvb3rSk2T3BrxgFJ4l9jLLSrUj0Ae5ABVlqPBr" -} \ No newline at end of file diff --git a/lib/controller/admin/captain_admin_controller.dart b/lib/controller/admin/captain_admin_controller.dart deleted file mode 100644 index f73327f..0000000 --- a/lib/controller/admin/captain_admin_controller.dart +++ /dev/null @@ -1,109 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:local_auth/local_auth.dart'; - -import '../../constant/colors.dart'; -import '../../constant/links.dart'; -import '../functions/crud.dart'; - -class CaptainAdminController extends GetxController { - bool isLoading = false; - Map captainData = {}; - Map captain = {}; - final captainController = TextEditingController(); - final captainPrizeController = TextEditingController(); - final titleNotify = TextEditingController(); - final bodyNotify = TextEditingController(); - final formCaptainKey = GlobalKey(); - final formCaptainPrizeKey = GlobalKey(); - - Future getCaptainCount() async { - isLoading = true; - update(); - var res = await CRUD().get(link: AppLink.getCaptainDetails, payload: {}); - var d = jsonDecode(res); - if (d['status'] == 'success') { - captainData = d; - print(captainData); - } - - isLoading = false; - update(); - } - - Future addCaptainPrizeToWallet() async { - String? paymentId; - //todo link to add wallet to captain - for (var i = 0; i < captainData['message'].length; i++) { - await CRUD().post(link: AppLink.addDriverPaymentPoints, payload: { - 'driverID': captainData['message'][i]['id'], - 'amount': captainPrizeController.text, - 'paymentMethod': 'Prize', - }).then((value) { - paymentId = value['message'].toString(); - }); - await CRUD().post(link: AppLink.addPassengersWallet, payload: { - 'driverID': captainData['message'][i]['id'], - 'amount': captainPrizeController.text, - 'paymentMethod': 'Prize', - 'paymentID': paymentId.toString(), - }); - } - - Get.back(); - } - - void addCaptainsPrizeToWalletSecure() async { - try { - // Check if local authentication is available - bool isAvailable = await LocalAuthentication().isDeviceSupported(); - if (isAvailable) { - // Authenticate the user - bool didAuthenticate = await LocalAuthentication().authenticate( - localizedReason: 'Use Touch ID or Face ID to confirm payment', - ); - if (didAuthenticate) { - // User authenticated successfully, proceed with payment - await addCaptainPrizeToWallet(); - Get.snackbar('Prize Added', '', backgroundColor: AppColor.greenColor); - } else { - // Authentication failed, handle accordingly - Get.snackbar('Authentication failed', '', - backgroundColor: AppColor.redColor); - // print( - // 'Authentication failed'); - } - } else { - // Local authentication not available, proceed with payment without authentication - await addCaptainPrizeToWallet(); - Get.snackbar('Prize Added', '', backgroundColor: AppColor.greenColor); - } - } catch (e) { - rethrow; - } - } - - Future getCaptains() async { - var res = await CRUD() - .get(link: AppLink.getCaptainDetailsByEmailOrIDOrPhone, payload: { - 'driver_id': captainController.text, - 'driverEmail': captainController.text, - 'driverPhone': captainController.text, - }); - var d = jsonDecode(res); - // print(d['message']); - if (d['status'] == 'success') { - captain = d; - } - // print(passengers); - update(); - } - - @override - void onInit() { - getCaptainCount(); - super.onInit(); - } -} diff --git a/lib/controller/admin/passenger_admin_controller.dart b/lib/controller/admin/passenger_admin_controller.dart deleted file mode 100644 index ce16916..0000000 --- a/lib/controller/admin/passenger_admin_controller.dart +++ /dev/null @@ -1,110 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:local_auth/local_auth.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/links.dart'; -import 'package:SEFER/controller/functions/crud.dart'; - -class PassengerAdminController extends GetxController { - bool isLoading = false; - Map passengersData = {}; - Map passengers = {}; - double height = 150; - final formPassKey = GlobalKey(); - final formPrizeKey = GlobalKey(); - final titleNotify = TextEditingController(); - final bodyNotify = TextEditingController(); - final passengerController = TextEditingController(); - final passengerPrizeController = TextEditingController(); - - Future getPassengerCount() async { - isLoading = true; - update(); - var res = await CRUD().get(link: AppLink.getPassengerDetails, payload: {}); - var d = jsonDecode(res); - if (d['status'] == 'success') { - passengersData = d; - } - - isLoading = false; - update(); - } - - Future addPassengerPrizeToWallet() async { - for (var i = 0; i < passengersData['message'].length; i++) { - await CRUD().post(link: AppLink.addPassengersWallet, payload: { - 'passenger_id': passengersData['message'][i]['id'], - 'balance': passengerPrizeController.text, - }); - } - - Get.back(); - } - - void addPassengerPrizeToWalletSecure() async { - try { - // Check if local authentication is available - bool isAvailable = await LocalAuthentication().isDeviceSupported(); - if (isAvailable) { - // Authenticate the user - bool didAuthenticate = await LocalAuthentication().authenticate( - localizedReason: 'Use Touch ID or Face ID to confirm payment', - ); - if (didAuthenticate) { - // User authenticated successfully, proceed with payment - await addPassengerPrizeToWallet(); - Get.snackbar('Prize Added', '', backgroundColor: AppColor.greenColor); - } else { - // Authentication failed, handle accordingly - Get.snackbar('Authentication failed', '', - backgroundColor: AppColor.redColor); - // print( - // 'Authentication failed'); - } - } else { - // Local authentication not available, proceed with payment without authentication - await addPassengerPrizeToWallet(); - Get.snackbar('Prize Added', '', backgroundColor: AppColor.greenColor); - } - } catch (e) { - rethrow; - } - } - - Future getPassengers() async { - var res = await CRUD().get(link: AppLink.getPassengerbyEmail, payload: { - 'passengerEmail': passengerController.text, - 'passengerId': passengerController.text, - 'passengerphone': passengerController.text, - }); - var d = jsonDecode(res); - // print(d['message']); - if (d['status'] == 'success') { - passengers = d; - } - // print(passengers); - update(); - } - - changeHeight() { - if (passengers.isEmpty) { - height = 0; - update(); - } - height = 150; - update(); - } - - void clearPlaces() { - passengers = {}; - update(); - } - - @override - void onInit() { - getPassengerCount(); - super.onInit(); - } -} diff --git a/lib/controller/admin/ride_admin_controller.dart b/lib/controller/admin/ride_admin_controller.dart deleted file mode 100644 index 9397b79..0000000 --- a/lib/controller/admin/ride_admin_controller.dart +++ /dev/null @@ -1,73 +0,0 @@ -import 'dart:convert'; - -import 'package:fl_chart/fl_chart.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/links.dart'; -import 'package:SEFER/controller/functions/crud.dart'; - -import '../../models/model/admin/monthly_ride.dart'; - -class RideAdminController extends GetxController { - bool isLoading = false; - late List rideData; - late Map jsonResponse; - List ridesDetails = []; - var chartData; - // late List chartDatasync; - Future getRidesAdminDash() async { - isLoading = true; - update(); - var res = await CRUD().get(link: AppLink.getRidesPerMonth, payload: {}); - jsonResponse = jsonDecode(res); - rideData = (jsonResponse['message'] as List) - .map((item) => MonthlyDataModel.fromJson(item)) - .toList(); - - chartData = rideData - .map((data) => FlSpot(data.day.toDouble(), data.ridesCount.toDouble())) - .toList(); - - // chartDatasync = (jsonResponse['message'] as List) - // .map((item) => ChartDataS( - // item['year'], - // item['month'], - // item['day'], - // item['rides_count'], - // )) - // .toList(); - isLoading = false; - update(); - } - - Future getRidesDetails() async { - // isLoading = true; - // update(); - var res = await CRUD().get(link: AppLink.getRidesDetails, payload: {}); - - var d = jsonDecode(res); - ridesDetails = d['message']; - - // isLoading = false; - // update(); - } - - @override - void onInit() async { - List initializationTasks = [ - getRidesAdminDash(), - getRidesDetails(), - ]; - // cameras = await availableCameras(); - await Future.wait(initializationTasks); - super.onInit(); - } -} - -// class ChartDataS { -// ChartDataS(this.year, this.month, this.day, this.ridesCount); - -// final int year; -// final int month; -// final int day; -// final int ridesCount; -// } diff --git a/lib/controller/admin/wallet_admin_controller.dart b/lib/controller/admin/wallet_admin_controller.dart deleted file mode 100644 index 1f8a534..0000000 --- a/lib/controller/admin/wallet_admin_controller.dart +++ /dev/null @@ -1,20 +0,0 @@ -import 'dart:convert'; - -import 'package:get/get.dart'; - -import '../../constant/links.dart'; -import '../functions/crud.dart'; - -class WalletAdminController extends GetxController { - bool isLoading = false; - - late Map jsonResponse; - List walletDetails = []; - - Future getWalletAdminDash() async { - isLoading = true; - update(); - var res = await CRUD().get(link: AppLink.getRidesPerMonth, payload: {}); - jsonResponse = jsonDecode(res); - } -} diff --git a/lib/controller/auth/captin/history_captain.dart b/lib/controller/auth/captin/history_captain.dart deleted file mode 100644 index 9f55437..0000000 --- a/lib/controller/auth/captin/history_captain.dart +++ /dev/null @@ -1,62 +0,0 @@ -import 'dart:convert'; - -import 'package:SEFER/views/widgets/elevated_btn.dart'; -import 'package:get/get.dart'; - -import '../../../constant/box_name.dart'; -import '../../../constant/links.dart'; -import '../../../main.dart'; -import '../../../views/home/Captin/history/history_details_page.dart'; -import '../../functions/crud.dart'; - -class HistoryCaptainController extends GetxController { - bool isloading = false; - Map historyData = {}; - Map historyDetailsData = {}; - late String orderID; - getOrderId(String orderId) { - orderID = orderId; - update(); - } - - getHistory() async { - isloading = true; - var res = await CRUD().get( - link: AppLink.getDriverOrder, - payload: {'driver_id': box.read(BoxName.driverID)}); - if (res != 'failure') { - historyData = jsonDecode(res); - print(historyData); - isloading = false; - update(); - } else { - Get.defaultDialog( - title: 'No ride yet'.tr, - middleText: '', - barrierDismissible: false, - confirm: MyElevatedButton( - title: 'Back'.tr, - onPressed: () { - Get.back(); - Get.back(); - })); - } - } - - getHistoryDetails(String orderId) async { - isloading = true; - var res = await CRUD() - .get(link: AppLink.getRideOrderID, payload: {'id': orderId}); - historyDetailsData = jsonDecode(res); - print(historyDetailsData); - isloading = false; - update(); - Get.to(() => HistoryDetailsPage()); - } - - @override - void onInit() { - getHistory(); - super.onInit(); - } -} diff --git a/lib/controller/auth/captin/login_captin_controller.dart b/lib/controller/auth/captin/login_captin_controller.dart deleted file mode 100644 index 69f5668..0000000 --- a/lib/controller/auth/captin/login_captin_controller.dart +++ /dev/null @@ -1,118 +0,0 @@ -import 'dart:convert'; -import 'dart:math'; - -import 'package:flutter/material.dart'; -import 'package:flutter_secure_storage/flutter_secure_storage.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/box_name.dart'; -import 'package:SEFER/constant/links.dart'; -import 'package:SEFER/controller/functions/crud.dart'; -import 'package:SEFER/controller/functions/secure_storage.dart'; -import 'package:SEFER/main.dart'; -import 'package:SEFER/views/auth/captin/verify_email_captain.dart'; -import 'package:SEFER/views/home/Captin/home_captain/home_captin.dart'; - -class LoginCaptinController extends GetxController { - final formKey = GlobalKey(); - TextEditingController emailController = TextEditingController(); - TextEditingController phoneController = TextEditingController(); - TextEditingController passwordController = TextEditingController(); - bool isAgreeTerms = false; - bool isloading = false; - final FlutterSecureStorage _storage = const FlutterSecureStorage(); - - void changeAgreeTerm() { - isAgreeTerms = !isAgreeTerms; - print(isAgreeTerms); - update(); - } - - void saveAgreementTerms() { - box.write(BoxName.agreeTerms, 'agreed'); - update(); - } - - void login() async { - isloading = true; - update(); - var res = await CRUD().get(link: AppLink.loginCaptin, payload: { - 'email': emailController.text, - 'phone': phoneController.text, - 'password': passwordController.text - }); - print(res); - if (res == 'Failure') { - isloading = false; - update(); - Get.snackbar('Failure', '', backgroundColor: Colors.red); - } else { - var jsonDecoeded = jsonDecode(res); - // print(jsonDecoeded); - if (jsonDecoeded.isNotEmpty) { - if (jsonDecoeded['status'] == 'success') { - print(jsonDecoeded['data'][0]['verified']); - if (jsonDecoeded['data'][0]['verified'] == '1') { - box.write(BoxName.driverID, jsonDecoeded['data'][0]['id']); - box.write(BoxName.emailDriver, jsonDecoeded['data'][0]['email']); - box.write( - BoxName.nameDriver, jsonDecoeded['data'][0]['first_name']); - box.write(BoxName.phoneDriver, jsonDecoeded['data'][0]['phone']); - SecureStorage() - .saveData(BoxName.passwordDriver, passwordController.text); - Get.offAll(() => HomeCaptain()); - isloading = false; - update(); - print(box.read(BoxName.driverID).toString()); - print(box.read(BoxName.tokenDriver)); - await CRUD().post(link: AppLink.addTokensDriver, payload: { - 'token': box.read(BoxName.tokenDriver), - 'captain_id': box.read(BoxName.driverID).toString() - }).then((value) => print('cccc')); - } else { - isloading = false; - update(); - Get.defaultDialog( - title: 'You must Verify email !.'.tr, - middleText: '', - backgroundColor: Colors.yellow[300], - onConfirm: () async { - int randomNumber = Random().nextInt(100000) + 1; - await CRUD().post(link: AppLink.sendVerifyEmail, payload: { - 'email': emailController.text, - 'token': randomNumber.toString(), - }).then((value) => print(value)); - Get.to(() => VerifyEmailCaptainPage()); - }, - ); - } - } else if (jsonDecoeded['status'] == 'Failure') { - Get.snackbar(jsonDecoeded['status'], jsonDecoeded['data'], - backgroundColor: Colors.redAccent); - isloading = false; - update(); - } - } else { - print('res is null'); - isloading = false; - update(); - } - } - } - - void loginByBoxData() async { - Get.to(() => HomeCaptain()); - await CRUD().post(link: AppLink.addTokensDriver, payload: { - 'token': box.read(BoxName.tokenDriver).toString(), - 'captain_id': box.read(BoxName.driverID).toString() - }); - } - - @override - void onInit() async { - super.onInit(); - - // if (box.read(BoxName.driverID).toString() != null) { - // loginByBoxData(); - // } - } -} diff --git a/lib/controller/auth/captin/ml_google_doc.dart b/lib/controller/auth/captin/ml_google_doc.dart deleted file mode 100644 index 6580a6b..0000000 --- a/lib/controller/auth/captin/ml_google_doc.dart +++ /dev/null @@ -1,103 +0,0 @@ -import 'dart:io'; - -import 'package:get/get.dart'; -import 'package:google_mlkit_text_recognition/google_mlkit_text_recognition.dart'; -import 'package:image_cropper/image_cropper.dart'; -import 'package:image_picker/image_picker.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/controller/functions/llama_ai.dart'; - -class CarRegistrationRecognizerController extends GetxController { - @override - void onInit() { - // scanText(); - super.onInit(); - } - - // The ImagePicker instance - final ImagePicker _imagePicker = ImagePicker(); - - // The GoogleMlKit TextRecognizer instance - final TextRecognizer _textRecognizer = TextRecognizer(); - - // The scanned text - String? scannedText; - String? jsonOutput; - final List> lines = []; - Map extracted = {}; - XFile? image; - CroppedFile? croppedFile; - // Picks an image from the camera or gallery and extracts the text - final List> extractedTextWithCoordinates = []; - - Future scanText() async { - // Pick an image from the camera or gallery - image = await _imagePicker.pickImage(source: ImageSource.gallery); - update(); - - // If no image was picked, return - if (image == null) { - return; - } - - // Crop the image - croppedFile = await ImageCropper().cropImage( - sourcePath: image!.path, - aspectRatioPresets: [ - CropAspectRatioPreset.square, - CropAspectRatioPreset.ratio3x2, - CropAspectRatioPreset.original, - CropAspectRatioPreset.ratio4x3, - CropAspectRatioPreset.ratio16x9 - ], - uiSettings: [ - AndroidUiSettings( - toolbarTitle: 'Cropper'.tr, - toolbarColor: AppColor.blueColor, - toolbarWidgetColor: AppColor.yellowColor, - initAspectRatio: CropAspectRatioPreset.original, - lockAspectRatio: false), - IOSUiSettings( - title: 'Cropper'.tr, - ), - ], - ); - - // If no cropped image was obtained, return - if (croppedFile == null) { - return; - } - - // Convert the cropped file to an InputImage object - final InputImage inputImage = InputImage.fromFile(File(croppedFile!.path)); - - // Recognize the text in the image - final RecognizedText recognizedText = - await _textRecognizer.processImage(inputImage); - scannedText = recognizedText.text; - - // Extract the scanned text line by line - final List> lines = []; - for (var i = 0; i < recognizedText.blocks.length; i++) { - lines.add({ - i.toString(): recognizedText.blocks[i].text, - }); - } - - String result = lines.map((map) => map.values.first.toString()).join(' '); - // print(result.length); - if (result.length > 2200) { - result = result.substring(0, 2200); - } - // print('jsonOutput------------------------------'); - // print(result); - Map result2 = await LlamaAi().getCarRegistrationData(result, - 'vin,make,made,year,expiration_date,color,owner,registration_date'); // - - // Assign the result to the extracted variable - extracted = result2; - - print('extracted is ' + extracted.toString()); - update(); - } -} diff --git a/lib/controller/auth/captin/register_captin_controller.dart b/lib/controller/auth/captin/register_captin_controller.dart deleted file mode 100644 index fd1a94c..0000000 --- a/lib/controller/auth/captin/register_captin_controller.dart +++ /dev/null @@ -1,197 +0,0 @@ -import 'dart:convert'; -import 'dart:math'; - -import 'package:SEFER/controller/auth/captin/login_captin_controller.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/box_name.dart'; -import 'package:SEFER/constant/links.dart'; -import 'package:SEFER/controller/functions/crud.dart'; -import 'package:SEFER/controller/functions/ocr_controller.dart'; -import 'package:SEFER/main.dart'; -import 'package:SEFER/views/auth/captin/login_captin.dart'; -import 'package:SEFER/views/auth/captin/verify_email_captain.dart'; - -import '../../../views/auth/captin/ai_page.dart'; -import '../../../views/auth/captin/car_license_page.dart'; -import '../../../views/home/Captin/home_captain/home_captin.dart'; - -class RegisterCaptainController extends GetxController { - final formKey = GlobalKey(); - - TextEditingController emailController = TextEditingController(); - TextEditingController phoneController = TextEditingController(); - TextEditingController passwordController = TextEditingController(); - TextEditingController verifyCode = TextEditingController(); - - String birthDate = 'Birth Date'.tr; - String gender = 'Male'.tr; - bool isLoading = false; - late String name; - late String licenseClass; - late String documentNo; - late String address; - late String height; - late String postalCode; - late String sex; - late String stateCode; - late String expireDate; - late String dob; - - getBirthDate() { - Get.defaultDialog( - title: 'Select Date'.tr, - content: SizedBox( - width: 300, - child: CalendarDatePicker( - initialDate: DateTime.now().subtract(const Duration(days: 18 * 365)), - firstDate: DateTime.parse('1940-06-01'), - lastDate: DateTime.now().subtract(const Duration(days: 18 * 365)), - onDateChanged: (date) { - // Get the selected date and convert it to a DateTime object - DateTime dateTime = date; - // Call the getOrders() function from the controller - birthDate = dateTime.toString().split(' ')[0]; - update(); - Get.back(); - }, - - // onDateChanged: (DateTime value) {}, - ), - ), - ); - } - - void changeGender(String value) { - gender = value; - update(); - } - - sendVerifications() async { - var res = await CRUD().post(link: AppLink.verifyEmail, payload: { - 'email': emailController.text.isEmpty - ? Get.find().emailController.text.toString() - : emailController.text, - 'token': verifyCode.text, - }); - - if (res != 'failure') { - if (Get.find().emailController.text.toString() != - '') { - Get.offAll(() => HomeCaptain()); - } else { - Get.to(() => CarLicensePage()); - } - } - } - - void nextToAIDetection() async { - //Todo dont forget this - if (formKey.currentState!.validate()) { - isLoading = true; - update(); - Get.to(() => AiPage()); - } - } - - Map payloadLisence = {}; - - void getFromController() { - name = Get.find().name; - licenseClass = Get.find().licenseClass.toString(); - documentNo = Get.find().documentNo.toString(); - address = Get.find().address.toString(); - height = Get.find().height.toString(); - postalCode = Get.find().address.toString(); - sex = Get.find().sex.toString(); - stateCode = Get.find().postalCode.toString(); - expireDate = Get.find().expireDate.toString(); - dob = Get.find().dob.toString(); - update(); - } - - Future addLisence() async { - getFromController(); - var res = await CRUD().post(link: AppLink.addLicense, payload: { - 'name': name, - 'licenseClass': licenseClass, - 'documentNo': documentNo, - 'address': address, - 'height': height, - 'postalCode': postalCode, - 'sex': sex, - 'stateCode': stateCode, - 'expireDate': expireDate, - 'dateOfBirth': dob, - }); - print(jsonDecode(res)); - isLoading = false; - update(); - if (jsonDecode(res)['status'] == 'success') { - // Get.to(() => AiPage()); //todo rplace this - } - } - - void addRegisrationCarForDriver(String vin, make, model, year, color, owner, - expirationDate, registrationDate) async { - getFromController(); - var res = await CRUD().post(link: AppLink.addRegisrationCar, payload: { - 'vin': vin, - 'make': make, - 'model': model, - 'year': year, - 'expirationDate': expirationDate, - 'color': color, - 'owner': owner, - 'registrationDate': registrationDate, - }); - print(jsonDecode(res)); - box.write(BoxName.vin, vin); - box.write(BoxName.make, make); - box.write(BoxName.model, model); - box.write(BoxName.year, year); - box.write(BoxName.expirationDate, expirationDate); - box.write(BoxName.color, color); - box.write(BoxName.owner, owner); - box.write(BoxName.registrationDate, registrationDate); - isLoading = false; - update(); - if (jsonDecode(res)['status'] == 'success') { - Get.offAll(() => LoginCaptin()); //todo replace this - } - } - - Future register() async { - getFromController(); - if (formKey.currentState!.validate()) { - isLoading = true; - update(); - var res = await CRUD().post(link: AppLink.signUpCaptin, payload: { - 'first_name': name.split(' ')[1], - 'last_name': name.split(' ')[0], - 'email': emailController.text, - 'phone': phoneController.text, - 'password': passwordController.text, - 'gender': sex, - 'site': address, - 'birthdate': dob, - }); - - isLoading = false; - update(); - if (jsonDecode(res)['status'] == 'success') { - box.write(BoxName.driverID, jsonDecode(res)['message']); - box.write(BoxName.dobDriver, dob); - box.write(BoxName.sexDriver, sex); - box.write(BoxName.phoneDriver, phoneController.text); - box.write(BoxName.lastNameDriver, name.split(' ')[0]); - int randomNumber = Random().nextInt(100000) + 1; - await CRUD().post(link: AppLink.sendVerifyEmail, payload: { - 'email': emailController.text, - 'token': randomNumber.toString(), - }).then((value) => print(value)); - Get.to(() => VerifyEmailCaptainPage()); - } - } - } -} diff --git a/lib/controller/auth/google_sign.dart b/lib/controller/auth/google_sign.dart index 7fa4c77..ac53fc6 100644 --- a/lib/controller/auth/google_sign.dart +++ b/lib/controller/auth/google_sign.dart @@ -3,8 +3,6 @@ import 'package:SEFER/main.dart'; import 'package:get/get.dart'; import 'package:google_sign_in/google_sign_in.dart'; -import '../../views/auth/captin/ai_page.dart'; - class GoogleSignInHelper { static final GoogleSignIn _googleSignIn = GoogleSignIn( scopes: [ @@ -17,7 +15,7 @@ class GoogleSignInHelper { try { final GoogleSignInAccount? googleUser = await _googleSignIn.signIn(); getDriverInfo(); - Get.to(() => AiPage()); + // Get.to(() => AiPage()); return googleUser; } catch (error) { print('Google Sign-In error: $error'); diff --git a/lib/controller/auth/login_controller.dart b/lib/controller/auth/login_controller.dart index 8fdaea2..86627bb 100644 --- a/lib/controller/auth/login_controller.dart +++ b/lib/controller/auth/login_controller.dart @@ -1,5 +1,4 @@ import 'dart:convert'; -import 'dart:io'; import 'dart:math'; import 'package:flutter/material.dart'; @@ -13,9 +12,6 @@ import 'package:SEFER/main.dart'; import 'package:SEFER/views/auth/verify_email_page.dart'; import 'package:SEFER/views/home/map_page_passenger.dart'; -import '../../views/admin/admin_home_page.dart'; -import '../functions/device_info.dart'; - class LoginController extends GetxController { final formKey = GlobalKey(); final formKeyAdmin = GlobalKey(); @@ -44,37 +40,37 @@ class LoginController extends GetxController { update(); } - void adminDashboardOpen() async { - if (formKeyAdmin.currentState!.validate()) { - await DeviceInfoPlus.getDeviceInfo(); - if (Platform.isAndroid) { - // print(DeviceInfoPlus.deviceDataList['serialNumber']); - // var res = await CRUD().get(link: AppLink.getAdminUser, payload: { - // // 'device_number': DeviceInfoPlus.deviceData['serialNumber'].toString(), - // }); - // var d = jsonDecode(res); - // // print(d); - // // if (DeviceInfoPlus.deviceData['serialNumber'] == - // d['message']['device_number']) { - Get.back(); - Get.to(() => const AdminHomePage()); - // } - } - if (Platform.isIOS) { - // print(DeviceInfoPlus.deviceData['identifierForVendor']); - // var res = await CRUD().get(link: AppLink.getAdminUser, payload: { - // 'device_number': DeviceInfoPlus.deviceData['identifierForVendor'].toString(), - // }); - // var d = jsonDecode(res); - // print(d); - // if (DeviceInfoPlus.deviceData['serialNumber'] == - // d['message']['device_number']) { - Get.back(); - Get.to(() => const AdminHomePage()); - // } - } - } - } + // void adminDashboardOpen() async { + // if (formKeyAdmin.currentState!.validate()) { + // await DeviceInfoPlus.getDeviceInfo(); + // if (Platform.isAndroid) { + // // print(DeviceInfoPlus.deviceDataList['serialNumber']); + // // var res = await CRUD().get(link: AppLink.getAdminUser, payload: { + // // // 'device_number': DeviceInfoPlus.deviceData['serialNumber'].toString(), + // // }); + // // var d = jsonDecode(res); + // // // print(d); + // // // if (DeviceInfoPlus.deviceData['serialNumber'] == + // // d['message']['device_number']) { + // Get.back(); + // Get.to(() => const AdminHomePage()); + // // } + // } + // if (Platform.isIOS) { + // // print(DeviceInfoPlus.deviceData['identifierForVendor']); + // // var res = await CRUD().get(link: AppLink.getAdminUser, payload: { + // // 'device_number': DeviceInfoPlus.deviceData['identifierForVendor'].toString(), + // // }); + // // var d = jsonDecode(res); + // // print(d); + // // if (DeviceInfoPlus.deviceData['serialNumber'] == + // // d['message']['device_number']) { + // Get.back(); + // Get.to(() => const AdminHomePage()); + // // } + // } + // } + // } void login() async { isloading = true; diff --git a/lib/controller/firebase/firbase_messge.dart b/lib/controller/firebase/firbase_messge.dart index 5abd8fd..7d292cd 100644 --- a/lib/controller/firebase/firbase_messge.dart +++ b/lib/controller/firebase/firbase_messge.dart @@ -1,8 +1,5 @@ import 'dart:convert'; import 'dart:io'; -import 'package:SEFER/controller/home/captin/home_captain_controller.dart'; -import 'package:SEFER/controller/home/captin/map_driver_controller.dart'; -import 'package:SEFER/views/home/Captin/home_captain/widget/call_page.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -18,14 +15,10 @@ import '../../constant/links.dart'; import '../../constant/style.dart'; import '../../main.dart'; import '../../views/Rate/rate_captain.dart'; -import '../../views/home/Captin/home_captain/home_captin.dart'; -import '../../views/home/Captin/orderCaptin/order_speed_request.dart'; import '../../views/home/map_page_passenger.dart'; import '../../views/home/map_widget.dart/call_passenger_page.dart'; import '../../views/home/profile/promos_passenger_page.dart'; -import '../../views/home/Captin/orderCaptin/order_request_page.dart'; import '../home/map_passenger_controller.dart'; -import '../payment/payment_controller.dart'; import 'local_notification.dart'; class FirebaseMessagesController extends GetxController { @@ -121,25 +114,6 @@ class FirebaseMessagesController extends GetxController { void fireBaseTitles(RemoteMessage message) { if (message.notification!.title! == 'Order') { - if (Platform.isAndroid) { - NotificationController().showNotification('Order', '', 'order'); - } - var myListString = message.data['DriverList']; - // var points = message.data['PolylineJson']; - - var myList = jsonDecode(myListString) as List; - // var myPoints = jsonDecode(points) as List; - driverToken = myList[14].toString(); - // This is for location using and uploading status - Get.put(HomeCaptainController()).changeRideId(); - update(); - // print('driverToken==============$driverToken'); - Get.to(() => OrderRequestPage(), arguments: { - 'myListString': myListString, - 'DriverList': myList, - // 'PolylineJson': myPoints, - 'body': message.notification!.body - }); } else if (message.notification!.title! == 'Apply Ride') { var passengerList = message.data['passengerList']; @@ -153,10 +127,6 @@ class FirebaseMessagesController extends GetxController { NotificationController() .showNotification('Promo', 'Show latest promo'.tr, 'promo'); Get.to(const PromosPassengerPage()); - } else if (message.notification!.title == 'Cancel Trip') { - NotificationController().showNotification( - 'Cancel Trip'.tr, 'Passenger Cancel Trip'.tr, 'cancel'); - cancelTripDialog(); } else if (message.notification!.title! == 'DriverIsGoingToPassenger') { Get.find().isDriverInPassengerWay = true; Get.find().update(); @@ -227,26 +197,6 @@ class FirebaseMessagesController extends GetxController { } catch (e) { print('Error navigating to PassengerCallPage: $e'); } - } else if (message.notification!.title! == 'Call Income from Passenger') { - try { - var myListString = message.data['passengerList']; - var driverList = jsonDecode(myListString) as List; - // if (Platform.isAndroid) { - NotificationController().showNotification( - 'Call Income'.tr, - message.notification!.body!, - 'iphone_ringtone', - ); - // } - // Assuming GetMaterialApp is initialized and context is valid for navigation - Get.to(() => CallPage( - // channelName: driverList[1].toString(), - // token: driverList[0].toString(), - // remoteID: driverList[2].toString(), - )); - } catch (e) { - print('Error navigating to PassengerCallPage: $e'); - } } else if (message.notification!.title! == 'Call End') { try { var myListString = message.data['passengerList']; @@ -259,7 +209,7 @@ class FirebaseMessagesController extends GetxController { ); } // Assuming GetMaterialApp is initialized and context is valid for navigation - Get.off(const CallPage()); + // Get.off(const CallPage()); } catch (e) { print('Error navigating to PassengerCallPage: $e'); } @@ -288,21 +238,6 @@ class FirebaseMessagesController extends GetxController { backgroundColor: AppColor.yellowColor, snackPosition: SnackPosition.BOTTOM, ); - } else if (message.notification!.title! == 'OrderSpeed') { - var myListString = message.data['DriverList']; - // var points = message.data['PolylineJson']; - - var myList = jsonDecode(myListString) as List; - // var myPoints = jsonDecode(points) as List; - driverToken = myList[14].toString(); - update(); - // print('driverToken==============$driverToken'); - Get.to(() => OrderSpeedRequest(), arguments: { - 'myListString': myListString, - 'DriverList': myList, - // 'PolylineJson': myPoints, - 'body': message.notification!.body - }); } else if (message.notification!.title! == 'Order Applied') { NotificationController().showNotification( 'The order Accepted by another Driver'.tr, @@ -334,18 +269,6 @@ class FirebaseMessagesController extends GetxController { ); } - Future cancelTripDialog() { - return Get.defaultDialog( - barrierDismissible: false, - title: 'Passenger Cancel Trip'.tr, - middleText: '', - confirm: MyElevatedButton( - title: 'Ok'.tr, - onPressed: () { - Get.offAll(HomeCaptain()); - })); - } - Future driverArrivePassengerDialoge() { return Get.defaultDialog( barrierDismissible: false, diff --git a/lib/controller/functions/call_controller.dart b/lib/controller/functions/call_controller.dart index 9976488..ca4c09e 100644 --- a/lib/controller/functions/call_controller.dart +++ b/lib/controller/functions/call_controller.dart @@ -7,7 +7,6 @@ import 'package:permission_handler/permission_handler.dart'; import '../../constant/box_name.dart'; import '../firebase/firbase_messge.dart'; -import '../home/captin/map_driver_controller.dart'; import '../../main.dart'; class CallController extends GetxController { @@ -23,15 +22,15 @@ class CallController extends GetxController { @override void onInit() { super.onInit(); - if (box.read(BoxName.passengerID) != null) { - channelName = Get.find().rideId; // 'sefer300'; // - remoteUid = int.parse(Get.find().driverPhone); - uid = int.parse(box.read(BoxName.phone)); - } else { - channelName = Get.find().rideId; // 'sefer300'; // - remoteUid = int.parse(Get.find().passengerPhone); - uid = int.parse(box.read(BoxName.phoneDriver)); - } + // if (box.read(BoxName.passengerID) != null) { + channelName = Get.find().rideId; // 'sefer300'; // + remoteUid = int.parse(Get.find().driverPhone); + uid = int.parse(box.read(BoxName.phone)); + // } else { + // channelName = Get.find().rideId; // 'sefer300'; // + // remoteUid = int.parse(Get.find().passengerPhone); + // uid = int.parse(box.read(BoxName.phoneDriver)); + // } initAgoraFull(); } @@ -46,12 +45,8 @@ class CallController extends GetxController { // join(); FirebaseMessagesController().sendNotificationToPassengerToken( 'Call Income from Passenger', - box.read(BoxName.passengerID) != null - ? '${'You have call from Passenger'.tr} ${box.read(BoxName.name)}' - : '${'You have call from driver'.tr} ${box.read(BoxName.nameDriver)}', - box.read(BoxName.passengerID) != null - ? Get.find().driverToken - : Get.find().tokenPassenger, + '${'You have call from Passenger'.tr} ${box.read(BoxName.name)}', + Get.find().driverToken, [ token, channelName, @@ -89,10 +84,8 @@ class CallController extends GetxController { }, onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) { // Get.snackbar("Remote user uid:$remoteUid joined the channel", ''); - status = - '${box.read(BoxName.passengerID) != null ? Get.find().driverName : Get.find().passengerName}' - ' joined' - .tr; + status = Get.find().driverName.toString(); + ' joined'.tr; remoteUid = remoteUid; update(); }, diff --git a/lib/controller/functions/camer_controller.dart b/lib/controller/functions/camer_controller.dart deleted file mode 100644 index a636fdb..0000000 --- a/lib/controller/functions/camer_controller.dart +++ /dev/null @@ -1,245 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; - -import 'package:camera/camera.dart'; -import 'package:get/get.dart'; -import 'package:google_mlkit_text_recognition/google_mlkit_text_recognition.dart'; -import 'package:SEFER/constant/box_name.dart'; -import 'package:SEFER/constant/links.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; -import 'package:path_provider/path_provider.dart' as path_provider; -import 'package:path/path.dart' as path; -import 'package:http/http.dart' as http; -import '../../main.dart'; - -class CameraClassController extends GetxController { - late CameraController cameraController; - late List cameras; - bool isCameraInitialized = false; - final TextRecognizer _textRecognizer = TextRecognizer(); - String? scannedText; - bool isloading = false; - - @override - void onInit() { - super.onInit(); - initializeCamera(); - } - - Future initializeCamera() async { - try { - cameras = await availableCameras(); - //update(); - cameraController = CameraController( - cameras[0], - ResolutionPreset.medium, - enableAudio: false, - ); - await cameraController.initialize(); - isCameraInitialized = true; - update(); - } catch (e) { - if (e is CameraException) { - switch (e.code) { - case 'CameraAccessDenied': - Get.defaultDialog( - title: 'Camera Access Denied.'.tr, - middleText: '', - confirm: - MyElevatedButton(title: 'Open Settings'.tr, onPressed: () {}), - ); - break; - default: - // Handle other errors here. - break; - } - } - } - } - - var imgUrl = ''; - Future extractCardId() async { - // Construct the path for the image file - final directory = await path_provider.getTemporaryDirectory(); - final imagePath = - path.join(directory.path, '${box.read(BoxName.driverID)}.png'); - - // Capture the image and save it to the specified path - final XFile capturedImage = await cameraController.takePicture(); - - // Move the captured image to the desired path - await capturedImage.saveTo(imagePath); - await uploadImage(File(capturedImage.path)); - - extractByAPI('${AppLink.server}/card_image/' + box.read(BoxName.driverID)); - } - - Future extractByAPI(String imgUrl) async { - var headers = {'apikey': 'K89368168788957'}; - var request = http.MultipartRequest( - 'POST', Uri.parse('https://api.ocr.space/parse/image')); - request.fields.addAll({ - 'language': 'ara', - 'isOverlayRequired': 'false', - 'url': imgUrl, - 'iscreatesearchablepdf': 'false', - 'issearchablepdfhidetextlayer': 'false' - }); - - request.headers.addAll(headers); - - http.StreamedResponse response = await request.send(); - - if (response.statusCode == 200) { - print(await response.stream.bytesToString()); - } else { - print(response.reasonPhrase); - } - } - - Future uploadImage(File imageFile) async { - String? basicAuthCredentials = - await storage.read(key: BoxName.basicAuthCredentials); - var request = http.MultipartRequest( - 'POST', - Uri.parse(AppLink.uploadImage), - ); - - // Attach the image file to the request - request.files.add( - await http.MultipartFile.fromPath('image', imageFile.path), - ); // Add the headers to the request - request.headers.addAll({ - "Content-Type": "application/x-www-form-urlencoded", - 'Authorization': - 'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}', - }); - - // Add the driverID to the request - request.fields['driverID'] = box.read(BoxName.driverID); - // Send the request - var response = await request.send(); - - // Read the response - var responseData = await response.stream.toBytes(); - var responseString = String.fromCharCodes(responseData); - scannedText = responseString; - update(); - // Return the link received from the server - return responseString; - } - - Future takePictureAndMLGoogleScan() async { - try { - // Construct the path for the image file - final directory = await path_provider.getTemporaryDirectory(); - final imagePath = - path.join(directory.path, '${box.read(BoxName.driverID)}.png'); - - // Capture the image and save it to the specified path - final XFile capturedImage = await cameraController.takePicture(); - - // Move the captured image to the desired path - await capturedImage.saveTo(imagePath); - - // Recognize the text in the image - final InputImage inputImage = - InputImage.fromFile(File(capturedImage.path)); - final RecognizedText recognizedText = - await _textRecognizer.processImage(inputImage); - scannedText = recognizedText.text; - - // Extract the scanned text line by line - final List> lines = []; - for (var i = 0; i < recognizedText.blocks.length; i++) { - lines.add({ - 'line_number': i, - 'text': recognizedText.blocks[i].text, - }); - } - - // Convert the list of lines to a JSON string - final String jsonOutput = jsonEncode(lines); - - update(); - - // Print the JSON output - print(jsonOutput); - - // Get.back(); - } catch (e) { - print('Error capturing image: $e'); - } - } - - String getTextAsJSON(String text) { - final lines = text.split('\n'); - final jsonList = lines.map((line) { - return { - 'line_text': line, - 'num_words': line.trim().split(' ').length, - }; - }).toList(); - - final json = { - 'lines': jsonList, - 'num_lines': lines.length, - }; - - return jsonEncode(json); - } - - List getTextBlocks(String text) { - return text.split('\n'); - } - -// Future takePictureAndTesseractScan() async { -// try { -// // Construct the path for the image file -// final directory = await path_provider.getTemporaryDirectory(); -// final imagePath = -// path.join(directory.path, '${box.read(BoxName.driverID)}.png'); - -// // Capture the image and save it to the specified path -// final XFile capturedImage = await cameraController.takePicture(); - -// // Move the captured image to the desired path -// await capturedImage.saveTo(imagePath); - -// // Recognize the text in the image -// final languages = [ -// 'eng', -// 'ara' -// ]; // Specify the languages you want to use for text extraction - -// final text = await FlutterTesseractOcr.extractText(imagePath, -// language: languages.join('+'), // Combine multiple languages with '+' -// args: { -// "psm": "4", -// "preserve_interword_spaces": "1", -// // "rectangle": const Rect.fromLTWH(100, 100, 200, 200), -// } // Additional options if needed -// ); -// isloading = false; -// final jsonText = getTextAsJSON(text); -// final textBlocks = getTextBlocks(text); -// update(); -// scannedText = -// textBlocks.toString(); // Convert the extracted text to JSON. - -// // Print the JSON to the console. -// print(jsonText); -// update(); -// // print(text); -// } catch (e) { -// print('Error during text extraction: $e'); -// scannedText = ''; -// } -// } - - @override - void onClose() { - cameraController.dispose(); - super.onClose(); - } -} diff --git a/lib/controller/functions/crud.dart b/lib/controller/functions/crud.dart index 19cd94e..a4400c7 100644 --- a/lib/controller/functions/crud.dart +++ b/lib/controller/functions/crud.dart @@ -7,8 +7,7 @@ import 'package:http/http.dart' as http; import 'package:SEFER/env/env.dart'; import '../../constant/api_key.dart'; -import 'gemeni.dart'; -import 'llama_ai.dart'; + import 'upload_image.dart'; class CRUD { @@ -106,7 +105,7 @@ class CRUD { Future.delayed(const Duration(seconds: 2)); String extracted = await arabicTextExtractByVisionAndAI(imagePath: imagePath); - await AI().geminiAiExtraction(prompt, extracted); + // await AI().geminiAiExtraction(prompt, extracted); } Future arabicTextExtractByVisionAndAI({ diff --git a/lib/controller/functions/document_scanner.dart b/lib/controller/functions/document_scanner.dart deleted file mode 100644 index 198992c..0000000 --- a/lib/controller/functions/document_scanner.dart +++ /dev/null @@ -1,41 +0,0 @@ -// import 'dart:io'; -// -// import 'package:get/get.dart'; -// import 'package:image_picker/image_picker.dart'; -// import 'package:google_ml_kit/google_ml_kit.dart'; -// -// class ImagePickerController extends GetxController { -// RxBool textScanning = false.obs; -// RxString scannedText = ''.obs; -// -// Future getImage(ImageSource source) async { -// try { -// final pickedImage = await ImagePicker().pickImage(source: source); -// if (pickedImage != null) { -// textScanning.value = true; -// final imageFile = File(pickedImage.path); -// getRecognisedText(imageFile); -// } -// } catch (e) { -// textScanning.value = false; -// scannedText.value = "Error occurred while scanning"; -// } -// } -// -// Future getRecognisedText(File image) async { -// final inputImage = InputImage.fromFilePath(image.path); -// final textDetector = GoogleMlKit.vision.textRecognizer(); -// final RecognizedText recognisedText = -// await textDetector.processImage(inputImage); -// await textDetector.close(); -// -// scannedText.value = ''; -// for (TextBlock block in recognisedText.blocks) { -// for (TextLine line in block.lines) { -// scannedText.value += line.text + '\n'; -// } -// } -// -// textScanning.value = false; -// } -// } diff --git a/lib/controller/functions/gemeni.dart b/lib/controller/functions/gemeni.dart deleted file mode 100644 index 11cb685..0000000 --- a/lib/controller/functions/gemeni.dart +++ /dev/null @@ -1,928 +0,0 @@ -import 'dart:convert'; -import 'dart:developer'; -import 'dart:io'; -import 'package:get/get.dart'; -import 'package:image_cropper/image_cropper.dart'; -import 'package:image_picker/image_picker.dart'; -import 'package:http/http.dart' as http; -import 'package:image/image.dart' as img; -import 'package:path_provider/path_provider.dart'; - -import '../../constant/api_key.dart'; -import '../../constant/colors.dart'; - -class AI extends GetxController { - final picker = ImagePicker(); - Map responseMap = {}; - Map responseCarLicenseMap = {}; - Map responseBackCarLicenseMap = {}; - Map responseIdCardeMap = {}; - bool isloading = false; - var image; - CroppedFile? croppedFile; - DateTime now = DateTime.now(); - Future pickImage() async { - final pickedImage = await picker.pickImage(source: ImageSource.gallery); - - if (pickedImage != null) { - image = File(pickedImage.path); - // Crop the image - croppedFile = await ImageCropper().cropImage( - sourcePath: image!.path, - aspectRatioPresets: [ - CropAspectRatioPreset.square, - CropAspectRatioPreset.ratio3x2, - CropAspectRatioPreset.original, - CropAspectRatioPreset.ratio4x3, - CropAspectRatioPreset.ratio16x9 - ], - uiSettings: [ - AndroidUiSettings( - toolbarTitle: 'Cropper'.tr, - toolbarColor: AppColor.blueColor, - toolbarWidgetColor: AppColor.yellowColor, - initAspectRatio: CropAspectRatioPreset.original, - lockAspectRatio: false), - IOSUiSettings( - title: 'Cropper'.tr, - ), - ], - ); - // image = croppedFile; - - // Resize the image - final rawImage = - img.decodeImage(File(croppedFile!.path).readAsBytesSync()); - final resizedImage = - img.copyResize(rawImage!, width: 800); // Adjust the width as needed - - final appDir = await getTemporaryDirectory(); - final resizedImagePath = '${appDir.path}/resized_image.jpg'; - - final resizedImageFile = File(resizedImagePath); - resizedImageFile.writeAsBytesSync( - img.encodeJpg(resizedImage)); // Save the resized image as JPEG - - image = resizedImageFile; - update(); - } - } - - Future generateContent() async { - await pickImage(); - if (image != null) { - final imageBytes = await image.readAsBytes(); - final imageData = base64Encode(imageBytes); - - var requestBody = jsonEncode({ - 'contents': [ - { - 'parts': [ - { - 'inlineData': { - 'mimeType': 'image/jpeg', - 'data': imageData, - }, - }, - { - 'text': - 'write json for all data as first name ,last name,dob,licenseID,expiration date,issued date asdress class type ,output json type', - }, - ], - }, - ], - 'generationConfig': { - 'temperature': 0.4, - 'topK': 32, - 'topP': 1, - 'maxOutputTokens': 4096, - 'stopSequences': [], - }, - 'safetySettings': [ - { - 'category': 'HARM_CATEGORY_HARASSMENT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_HATE_SPEECH', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_SEXUALLY_EXPLICIT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_DANGEROUS_CONTENT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - ], - }); - print(requestBody); - - final response = await http.post( - Uri.parse( - 'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro-vision:generateContent?key=${AK.geminiApi}'), - headers: {'Content-Type': 'application/json'}, - body: requestBody, - ); - - if (response.statusCode == 200) { - var responseData = jsonDecode(response.body); - // Process the responseData as needed - // print(responseData); - - var result = - responseData['candidates'][0]['content']['parts'][0]['text']; - // print(jsonEncode(result)); - // print((result)); - // print(result['dob']); - RegExp regex = RegExp(r"```json([^`]*)```"); - String? jsonString = - regex.firstMatch(responseData.toString())?.group(1)?.trim(); - - if (jsonString != null) { - // Convert the JSON object to a String - jsonString = jsonEncode(json.decode(jsonString)); - print(jsonString); - } else { - print("JSON string not found"); - } - - // Rest of your code... - } else { - print('Request failed with status: ${response.statusCode}'); - print('Request failed with status: ${response.body}'); - } - } else { - print('No image selected'); - } - } - - Future geminiAiExtraction(String prompt, payload) async { - var requestBody = jsonEncode({ - 'contents': [ - { - 'parts': [ - // { - // 'inlineData': { - // 'mimeType': 'image/jpeg', - // 'data': imageData, - // }, - // }, - { - 'text': - "Extract the desired information from the following passage as json decoded like $prompt just in this:\n\n$payload" - }, - ], - }, - ], - 'generationConfig': { - 'temperature': 0.4, - 'topK': 32, - 'topP': 1, - 'maxOutputTokens': 4096, - 'stopSequences': [], - }, - 'safety_settings': [ - {"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_NONE"}, - {"category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_NONE"}, - { - "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", - "threshold": "BLOCK_NONE" - }, - { - "category": "HARM_CATEGORY_DANGEROUS_CONTENT", - "threshold": "BLOCK_NONE" - }, - ] - }); - print(requestBody); - - final response = await http.post( - Uri.parse( - // 'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro-vision:generateContent?key=${AK.geminiApi}'), - 'https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-pro-latest:generateContent?key=AIzaSyCyoLcSkDzK5_SMe00nhut56SSXWPR074w'), - headers: {'Content-Type': 'application/json'}, - body: requestBody, - ); - - if (response.statusCode == 200) { - var responseData = jsonDecode(response.body); - // Process the responseData as needed - // print(responseData); - - var result = responseData['candidates'][0]['content']['parts'][0]['text']; - // print(jsonEncode(result)); - // print((result)); - // print(result['dob']); - RegExp regex = RegExp(r"```json([^`]*)```"); - String? jsonString = - regex.firstMatch(responseData.toString())?.group(1)?.trim(); - - if (jsonString != null) { - // Convert the JSON object to a String - jsonString = jsonEncode(json.decode(jsonString)); - print(jsonString); - } else { - print("JSON string not found"); - } - - // Rest of your code... - } else { - print('Request failed with status: ${response.statusCode}'); - print('Request failed with status: ${response.body}'); - } - } - - Future getDriverLicenseJordanContent() async { - await pickImage(); - isloading = true; - update(); - if (image != null) { - final imageBytes = await image.readAsBytes(); - final imageData = base64Encode(imageBytes); - - var requestBody = jsonEncode({ - 'contents': [ - { - 'parts': [ - { - 'inlineData': { - 'mimeType': 'image/jpeg', - 'data': imageData, - }, - }, - { - 'text': - 'write json for all data as first name ,last name,dob,id ,expiration date,issued date asdress class type,age in years ,output json type in arabic value and stay engish key and make date format like YYYY-MM-DD , for name please extract name in arabic in Name in json plus first_name ', - }, - ], - }, - ], - 'generationConfig': { - 'temperature': 0.4, - 'topK': 32, - 'topP': 1, - 'maxOutputTokens': 4096, - 'stopSequences': [], - }, - 'safetySettings': [ - { - 'category': 'HARM_CATEGORY_HARASSMENT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_HATE_SPEECH', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_SEXUALLY_EXPLICIT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_DANGEROUS_CONTENT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - ], - }); - print(requestBody); - - final response = await http.post( - Uri.parse( - 'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro-vision:generateContent?key=${AK.geminiApi}'), - headers: {'Content-Type': 'application/json'}, - body: requestBody, - ); - isloading = false; - update(); - if (response.statusCode == 200) { - var responseData = jsonDecode(response.body); - // Process the responseData as needed - // print(responseData); - - var result = - responseData['candidates'][0]['content']['parts'][0]['text']; - // print(jsonEncode(result)); - // print((result)); - // print(result['dob']); - RegExp regex = RegExp(r"```json([^`]*)```"); - String? jsonString = - regex.firstMatch(responseData.toString())?.group(1)?.trim(); - - if (jsonString != null) { - // Convert the JSON object to a String - jsonString = jsonEncode(json.decode(jsonString)); - responseMap = jsonDecode(jsonString); - print(jsonString); - print(responseMap); - print(responseMap['dob']); - } else { - print("JSON string not found"); - } - - // Rest of your code... - } else { - print('Request failed with status: ${response.statusCode}'); - print('Request failed with status: ${response.body}'); - } - } else { - print('No image selected'); - } - } - - Future getCarLicenseJordanContent() async { - await pickImage(); - isloading = true; - update(); - if (image != null) { - final imageBytes = await image.readAsBytes(); - final imageData = base64Encode(imageBytes); - - var requestBody = jsonEncode({ - 'contents': [ - { - 'parts': [ - { - 'inlineData': { - 'mimeType': 'image/jpeg', - 'data': imageData, - }, - }, - { - 'text': - '''Extract the following information from the front face of the Jordanian ID card: -Name -National ID number -Gender -Date of birth -Output the extracted information in the following JSON format''', - }, - ], - }, - ], - 'generationConfig': { - 'temperature': 0.4, - 'topK': 32, - 'topP': 1, - 'maxOutputTokens': 4096, - 'stopSequences': [], - }, - 'safetySettings': [ - { - 'category': 'HARM_CATEGORY_HARASSMENT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_HATE_SPEECH', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_SEXUALLY_EXPLICIT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_DANGEROUS_CONTENT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - ], - }); - print(requestBody); - - final response = await http.post( - Uri.parse( - // 'https://${API_ENDPOINT}/v1/projects/${PROJECT_ID}/locations/${LOCATION_ID}/publishers/google/models/${MODEL_ID}:streamGenerateContent'), - 'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro-vision:generateContent?key=${AK.geminiApi}'), - headers: {'Content-Type': 'application/json'}, - body: requestBody, - ); - isloading = false; - update(); - if (response.statusCode == 200) { - var responseData = jsonDecode(response.body); - // Process the responseData as needed - // print(responseData); - - var result = - responseData['candidates'][0]['content']['parts'][0]['text']; - // print(jsonEncode(result)); - // print((result)); - // print(result['dob']); - RegExp regex = RegExp(r"```json([^`]*)```"); - String? jsonString = - regex.firstMatch(responseData.toString())?.group(1)?.trim(); - - if (jsonString != null) { - // Convert the JSON object to a String - jsonString = jsonEncode(json.decode(jsonString)); - responseCarLicenseMap = jsonDecode(jsonString); - print(jsonString); - print(responseCarLicenseMap); - print(responseCarLicenseMap['plate_number']); - } else { - print("JSON string not found"); - } - - // Rest of your code... - } else { - print('Request failed with status: ${response.statusCode}'); - print('Request failed with status: ${response.body}'); - } - } else { - print('No image selected'); - } - } - - Future jordanID() async { - await pickImage(); - isloading = true; - update(); - if (image != null) { - final imageBytes = await image.readAsBytes(); - final imageData = base64Encode(imageBytes); - - var requestBody = jsonEncode({ - 'contents': [ - { - 'parts': [ - { - 'inlineData': { - 'mimeType': 'image/jpeg', - 'data': imageData, - }, - }, - { - 'text': - '''Extract the following information from the front face of the Jordanian ID card: -Name -National ID number -Gender -Date of birth -Output the extracted information in the following JSON format''', - }, - ], - }, - ], - 'generationConfig': { - 'temperature': 0.4, - 'topK': 32, - 'topP': 1, - 'maxOutputTokens': 4096, - 'stopSequences': [], - }, - 'safetySettings': [ - { - 'category': 'HARM_CATEGORY_HARASSMENT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_HATE_SPEECH', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_SEXUALLY_EXPLICIT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_DANGEROUS_CONTENT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - ], - }); - print(requestBody); - - final response = await http.post( - Uri.parse( - 'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro-vision:generateContent?key=${AK.geminiApi}'), - headers: {'Content-Type': 'application/json'}, - body: requestBody, - ); - isloading = false; - update(); - if (response.statusCode == 200) { - var responseData = jsonDecode(response.body); - // Process the responseData as needed - // print(responseData); - - var result = - responseData['candidates'][0]['content']['parts'][0]['text']; - // print(jsonEncode(result)); - // print((result)); - // print(result['dob']); - RegExp regex = RegExp(r"```json([^`]*)```"); - String? jsonString = - regex.firstMatch(responseData.toString())?.group(1)?.trim(); - - if (jsonString != null) { - // Convert the JSON object to a String - jsonString = jsonEncode(json.decode(jsonString)); - responseCarLicenseMap = jsonDecode(jsonString); - print(jsonString); - print(responseCarLicenseMap); - print(responseCarLicenseMap['plate_number']); - } else { - print("JSON string not found"); - } - - // Rest of your code... - } else { - print('Request failed with status: ${response.statusCode}'); - print('Request failed with status: ${response.body}'); - } - } else { - print('No image selected'); - } - } - - Future carLicenseJordan() async { - await pickImage(); - isloading = true; - update(); - if (image != null) { - final imageBytes = await image.readAsBytes(); - final imageData = base64Encode(imageBytes); - - var requestBody = jsonEncode({ - 'contents': [ - { - 'parts': [ - { - 'inlineData': { - 'mimeType': 'image/jpeg', - 'data': imageData, - }, - }, - { - 'text': - '''Extract the following information from the front face of the car license card in Jordan: - -* name -* Address -* Vehicle type -* car_kind -* car_color -* Vehicle category -* car_year -* car_plate -* Registration type -* Usage type -* expire_date_of_license - -Output the extracted information in the following JSON formate and make date format like YYYY-MM-DD''', - }, - ], - }, - ], - 'generationConfig': { - 'temperature': 0.4, - 'topK': 32, - 'topP': 1, - 'maxOutputTokens': 4096, - 'stopSequences': [], - }, - 'safetySettings': [ - { - 'category': 'HARM_CATEGORY_HARASSMENT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_HATE_SPEECH', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_SEXUALLY_EXPLICIT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_DANGEROUS_CONTENT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - ], - }); - print(requestBody); - - final response = await http.post( - Uri.parse( - 'https://generativelanguage.googleapis.com/v1beta/models/gemini-1.0-pro-vision-latest:generateContent?key=${AK.geminiApi}'), - headers: {'Content-Type': 'application/json'}, - body: requestBody, - ); - isloading = false; - update(); - if (response.statusCode == 200) { - var responseData = jsonDecode(response.body); - // Process the responseData as needed - // print(responseData); - - var result = - responseData['candidates'][0]['content']['parts'][0]['text']; - // print(jsonEncode(result)); - // print((result)); - // print(result['dob']); - RegExp regex = RegExp(r"```json([^`]*)```"); - String? jsonString = - regex.firstMatch(responseData.toString())?.group(1)?.trim(); - - if (jsonString != null) { - // Convert the JSON object to a String - jsonString = jsonEncode(json.decode(jsonString)); - responseCarLicenseMap = jsonDecode(jsonString); - print(jsonString); - print(responseCarLicenseMap); - print(responseCarLicenseMap['plate_number']); - } else { - print("JSON string not found"); - } - - // Rest of your code... - } else { - print('Request failed with status: ${response.statusCode}'); - print('Request failed with status: ${response.body}'); - } - } else { - print('No image selected'); - } - } - - Future getTextFromCard(String prompt) async { - await pickImage(); - isloading = true; - update(); - if (image != null) { - final imageBytes = await image.readAsBytes(); - final imageData = base64Encode(imageBytes); - - var requestBody = jsonEncode({ - 'contents': [ - { - 'parts': [ - { - 'inlineData': { - 'mimeType': 'image/jpeg', - 'data': imageData, - }, - }, - { - 'text': prompt, - }, - ], - }, - ], - 'generationConfig': { - "temperature": 1, - "topK": 32, - "topP": 0.1, - "maxOutputTokens": 4096, - "stopSequences": [] - }, - 'safetySettings': [ - { - 'category': 'HARM_CATEGORY_HARASSMENT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_HATE_SPEECH', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_SEXUALLY_EXPLICIT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_DANGEROUS_CONTENT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - ], - }); - print(requestBody); - - final response = await http.post( - Uri.parse( - 'https://generativelanguage.googleapis.com/v1beta/models/gemini-1.0-pro-vision-latest:generateContent?key=${AK.geminiApi}'), - headers: {'Content-Type': 'application/json'}, - body: requestBody, - ); - isloading = false; - update(); - if (response.statusCode == 200) { - var responseData = jsonDecode(response.body); - // Process the responseData as needed - // print(responseData); - - var result = - responseData['candidates'][0]['content']['parts'][0]['text']; - // print(jsonEncode(result)); - // print((result)); - // print(result['dob']); - RegExp regex = RegExp(r"```json([^`]*)```"); - String? jsonString = - regex.firstMatch(responseData.toString())?.group(1)?.trim(); - - if (jsonString != null) { - // Convert the JSON object to a String - jsonString = jsonEncode(json.decode(jsonString)); - responseBackCarLicenseMap = jsonDecode(jsonString); - // print(jsonString); - print(responseBackCarLicenseMap); - // print(responseCarLicenseMap['plate_number']); - } else { - print("JSON string not found"); - } - - // Rest of your code... - } else { - print('Request failed with status: ${response.statusCode}'); - print('Request failed with status: ${response.body}'); - } - } else { - print('No image selected'); - } - } - - Future generateBackCarLicenseJordanContent() async { - await pickImage(); - isloading = true; - update(); - if (image != null) { - final imageBytes = await image.readAsBytes(); - final imageData = base64Encode(imageBytes); - - var requestBody = jsonEncode({ - 'contents': [ - { - 'parts': [ - { - 'inlineData': { - 'mimeType': 'image/jpeg', - 'data': imageData, - }, - }, - { - 'text': - 'write json output from extracting car license back face for these key ,vin,fuelType,passengerType,curbWeight,insuranceCompany,policyNumber,notes,insuranceType and output it json .dont add data else this image', - }, - ], - }, - ], - 'generationConfig': { - 'temperature': 0.4, - 'topK': 343, - 'topP': 1, - 'maxOutputTokens': 4096, - 'stopSequences': [], - }, - 'safetySettings': [ - { - 'category': 'HARM_CATEGORY_HARASSMENT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_HATE_SPEECH', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_SEXUALLY_EXPLICIT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_DANGEROUS_CONTENT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - ], - }); - print(requestBody); - - final response = await http.post( - Uri.parse( - 'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro-vision:generateContent?key=${AK.geminiApi}'), - headers: {'Content-Type': 'application/json'}, - body: requestBody, - ); - isloading = false; - update(); - if (response.statusCode == 200) { - var responseData = jsonDecode(response.body); - // Process the responseData as needed - // print(responseData); - - var result = - responseData['candidates'][0]['content']['parts'][0]['text']; - // print(jsonEncode(result)); - // print((result)); - // print(result['dob']); - RegExp regex = RegExp(r"```json([^`]*)```"); - String? jsonString = - regex.firstMatch(responseData.toString())?.group(1)?.trim(); - - if (jsonString != null) { - // Convert the JSON object to a String - jsonString = jsonEncode(json.decode(jsonString)); - responseBackCarLicenseMap = jsonDecode(jsonString); - // print(jsonString); - print(responseBackCarLicenseMap); - // print(responseCarLicenseMap['plate_number']); - } else { - print("JSON string not found"); - } - - // Rest of your code... - } else { - print('Request failed with status: ${response.statusCode}'); - print('Request failed with status: ${response.body}'); - } - } else { - print('No image selected'); - } - } - - Future getFromCarRegistration() async { - await pickImage(); - if (image != null) { - final imageBytes = await image.readAsBytes(); - final imageData = base64Encode(imageBytes); - - var requestBody = jsonEncode({ - 'contents': [ - { - 'parts': [ - { - 'inlineData': { - 'mimeType': 'image/jpeg', - 'data': imageData, - }, - }, - { - 'text': - 'write output json from image for[ vin, make, model, year, expiration_date, color, owner, registration_date ],output json type ', - }, - ], - }, - ], - 'generationConfig': { - 'temperature': 0.4, - 'topK': 32, - 'topP': 1, - 'maxOutputTokens': 4096, - 'stopSequences': [], - }, - 'safetySettings': [ - { - 'category': 'HARM_CATEGORY_HARASSMENT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_HATE_SPEECH', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_SEXUALLY_EXPLICIT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - { - 'category': 'HARM_CATEGORY_DANGEROUS_CONTENT', - 'threshold': 'BLOCK_MEDIUM_AND_ABOVE', - }, - ], - }); - print(requestBody); - - final response = await http.post( - Uri.parse( - 'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro-vision:generateContent?key=${AK.geminiApi}'), - headers: {'Content-Type': 'application/json'}, - body: requestBody, - ); - - if (response.statusCode == 200) { - var responseData = jsonDecode(response.body); - // Process the responseData as needed - var result = - responseData['candidates'][0]['content']['parts'][0]['text']; - print(result); - RegExp regex = RegExp(r"```json([^`]*)```"); - String? jsonString = - regex.firstMatch(responseData.toString())?.group(1)?.trim(); - - if (jsonString != null) { - // Convert the JSON object to a String - jsonString = jsonEncode(json.decode(jsonString)); - print(jsonString); - } else { - print("JSON string not found"); - } - - // Rest of your code... - } else { - print('Request failed with status: ${response.statusCode}'); - print('Request failed with status: ${response.body}'); - } - } else { - print('No image selected'); - } - } - - @override - void onInit() { - // generateContent(); - super.onInit(); - } -} diff --git a/lib/controller/functions/llama_ai.dart b/lib/controller/functions/llama_ai.dart deleted file mode 100644 index 6baebb1..0000000 --- a/lib/controller/functions/llama_ai.dart +++ /dev/null @@ -1,44 +0,0 @@ -import 'dart:convert'; - -import 'package:SEFER/constant/links.dart'; -import 'package:SEFER/controller/functions/crud.dart'; -import 'package:SEFER/controller/functions/gemeni.dart'; - -class LlamaAi { - Future getCarRegistrationData(String input, prompt) async { - print(true); - Map exrtatDataFinal = {}; - String oneLine = input.replaceAll('\n', ' '); - // print(oneLine); - // var res = await CRUD().getLlama(link: AppLink.gemini, payload: oneLine); - var res = await CRUD() - .getLlama(link: AppLink.llama, payload: oneLine, prompt: prompt); - - print(res); - var decod = jsonDecode(res.toString()); - print(decod); - // exrtatDataFinal = jsonDecode(extractDataFromJsonString(decod['choices'])); - extractDataFromJsonString(decod['choices'][0]['message']['content']); - print(jsonEncode(exrtatDataFinal)); - print(false); - return exrtatDataFinal; - } - - String extractDataFromJsonString(String jsonString) { - // Remove any leading or trailing whitespace from the string - jsonString = jsonString.trim(); - - // Extract the JSON substring from the given string - final startIndex = jsonString.indexOf('{'); - final endIndex = jsonString.lastIndexOf('}'); - final jsonSubstring = jsonString.substring(startIndex, endIndex + 1); - - // Parse the JSON substring into a Map - final jsonData = jsonDecode(jsonSubstring); - - // Return the extracted data - - // print(jsonEncode(jsonData)); - return jsonEncode(jsonData); - } -} diff --git a/lib/controller/functions/location_controller.dart b/lib/controller/functions/location_controller.dart index ac0dcbf..01217e9 100644 --- a/lib/controller/functions/location_controller.dart +++ b/lib/controller/functions/location_controller.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:SEFER/controller/home/captin/home_captain_controller.dart'; import 'package:get/get.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:location/location.dart'; @@ -10,8 +9,6 @@ import 'package:SEFER/controller/functions/crud.dart'; import 'package:SEFER/controller/home/payment/captain_wallet_controller.dart'; import 'package:SEFER/main.dart'; -import '../home/captin/map_driver_controller.dart'; - // LocationController.dart class LocationController extends GetxController { LocationData? _currentLocation; @@ -71,39 +68,6 @@ class LocationController extends GetxController { : totalDistance.toStringAsFixed(1), 'status': box.read(BoxName.statusDriverLocation).toString() }); - // Animate camera to user location (optional) - // if (Get.find().rideId == 'rideId') { - // Get.find() - // .mapController! - // .animateCamera(CameraUpdate.newLatLng(LatLng( - // Get.find().myLocation.latitude, - // Get.find().myLocation.longitude, - // ))); - // } - Get.find() - .mapHomeCaptainController - .animateCamera(CameraUpdate.newLatLng(LatLng( - Get.find().myLocation.latitude, - Get.find().myLocation.longitude, - ))); - // if (Get.find().rideId == '0') { - // await sql.insertData({ - // 'driver_id': box.read(BoxName.driverID), - // 'latitude': myLocation.latitude.toString(), - // 'longitude': myLocation.longitude.toString(), - // 'created_at': DateTime.now().toString(), - // }, TableName.carLocations); - // } else { - // await sql.insertData({ - // 'order_id': Get.find().rideId, - // 'created_at': DateTime.now().toString(), - // 'lat': myLocation.latitude.toString(), - // 'lng': myLocation.longitude.toString(), - // }, TableName.rideLocation); - // } - // } - - // } // } @@ -157,17 +121,17 @@ class LocationController extends GetxController { speed = _locationData.speed!; heading = _locationData.heading!; // Calculate the distance between the current location and the previous location - if (Get.find().rideId == 'rideId') { - if (previousTime > 0) { - double distance = calculateDistanceInKmPerHour( - previousTime, _locationData.time, speed); - print('distance $distance'); - totalDistance += distance; - } - // print('totalDistance: $totalDistance'); + // if (Get.find().rideId == 'rideId') { + // if (previousTime > 0) { + // double distance = calculateDistanceInKmPerHour( + // previousTime, _locationData.time, speed); + // print('distance $distance'); + // totalDistance += distance; + // } + // // print('totalDistance: $totalDistance'); - previousTime = _locationData.time!; - } + // previousTime = _locationData.time!; + // } // Print location details // print('myLocation: ${myLocation}'); // print('Accuracy: ${_locationData.accuracy}'); diff --git a/lib/controller/functions/ocr_controller.dart b/lib/controller/functions/ocr_controller.dart deleted file mode 100644 index fe59d37..0000000 --- a/lib/controller/functions/ocr_controller.dart +++ /dev/null @@ -1,673 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; -import 'dart:typed_data'; -import 'package:camera/camera.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:image_picker/image_picker.dart'; -import 'package:http/http.dart' as http; -import 'package:SEFER/constant/api_key.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/info.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/constant/table_names.dart'; -import 'package:SEFER/main.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; - -import '../../constant/box_name.dart'; -import '../../constant/links.dart'; -import '../auth/captin/register_captin_controller.dart'; -import 'launch.dart'; - -// -// class TextExtractionController extends GetxController { -// String extractedText = ''; -// bool isloading = false; -// File? _scannedImage; -// // Convert the extracted text to JSON -// // Convert the extracted text to JSON -// String getTextAsJSON(String text) { -// final lines = text.split('\n'); -// final jsonList = lines.map((line) { -// return { -// 'line_text': line, -// 'num_words': line.trim().split(' ').length, -// }; -// }).toList(); -// -// final json = { -// 'lines': jsonList, -// 'num_lines': lines.length, -// }; -// -// return jsonEncode(json); -// } -// -// // Convert the extracted text to blocks by line -// List getTextBlocks(String text) { -// return text.split('\n'); -// } -// -// // Future pickAndExtractText() async { -// // final pickedImage = await ImagePicker().pickImage( -// // source: ImageSource.camera, -// // preferredCameraDevice: CameraDevice.rear, -// // maxHeight: Get.height * .3, -// // maxWidth: Get.width * .8, -// // imageQuality: 99, -// // ); -// // if (pickedImage != null) { -// // isloading = true; -// // update(); -// // final imagePath = pickedImage.path; -// // final languages = [ -// // 'eng', -// // 'ara' -// // ]; // Specify the languages you want to use for text extraction -// -// // try { -// // final text = await FlutterTesseractOcr.extractText(imagePath, -// // language: -// // languages.join('+'), // Combine multiple languages with '+' -// // args: { -// // "psm": "4", -// // "preserve_interword_spaces": "1", -// // // "rectangle": const Rect.fromLTWH(100, 100, 200, 200), -// // } // Additional options if needed -// // ); -// // isloading = false; -// // final jsonText = getTextAsJSON(text); -// // final textBlocks = getTextBlocks(text); -// // update(); -// // extractedText = -// // textBlocks.toString(); // Convert the extracted text to JSON. -// -// // // Print the JSON to the console. -// // print(jsonText); -// // update(); -// // // print(text); -// // } catch (e) { -// // print('Error during text extraction: $e'); -// // extractedText = ''; -// // } -// // } -// // } -// } - -// class TextMLGoogleRecognizerController extends GetxController { -// @override -// void onInit() { -// scanText(); -// super.onInit(); -// } -// -// // The ImagePicker instance -// final ImagePicker _imagePicker = ImagePicker(); -// -// // The GoogleMlKit TextRecognizer instance -// final TextRecognizer _textRecognizer = TextRecognizer(); -// -// // The scanned text -// String? scannedText; -// String? jsonOutput; -// final List> lines = []; -// -// Map decode = {}; -// -// Future scanText() async { -// // Pick an image from the camera or gallery -// final XFile? image = -// await _imagePicker.pickImage(source: ImageSource.gallery); -// -// // If no image was picked, return -// if (image == null) { -// return; -// } -// -// // Convert the XFile object to an InputImage object -// final InputImage inputImage = InputImage.fromFile(File(image.path)); -// -// // Recognize the text in the image -// final RecognizedText recognizedText = -// await _textRecognizer.processImage(inputImage); -// scannedText = recognizedText.text; -// Map extractedData = {}; -// // Extract the scanned text line by line -// for (var i = 0; i < recognizedText.blocks.length; i++) { -// final block = recognizedText.blocks[i]; -// for (final line in block.lines) { -// final lineText = line.text; -// -// if (lineText.contains('DL')) { -// final dlNumber = lineText.split('DL')[1].trim(); -// extractedData['dl_number'] = dlNumber; -// } -// if (lineText.contains('USA')) { -// final usa = lineText.split('USA')[1].trim(); -// extractedData['USA'] = usa; -// } -// if (lineText.contains('DRIVER LICENSE')) { -// final driverl = lineText; -// extractedData['DRIVER_LICENSE'] = driverl; -// } -// -// if (lineText.contains('EXP')) { -// final expiryDate = lineText.split('EXP')[1].trim(); -// extractedData['expiry_date'] = expiryDate; -// } -// -// if (lineText.contains('DOB')) { -// final dob = lineText.split('DOB')[1].trim(); -// extractedData['dob'] = dob; -// } -// -// if (lineText.contains("LN")) { -// if ((lineText.indexOf("LN") == 0)) { -// final lastName = lineText.split('LN')[1].trim(); -// extractedData['lastName'] = lastName; -// } -// } -// if (lineText.contains("FN")) { -// final firstName = lineText.split('FN')[1].trim(); -// extractedData['firstName'] = firstName; -// } -// if (lineText.contains("RSTR")) { -// final rstr = lineText.split('RSTR')[1].trim(); -// extractedData['rstr'] = rstr; -// } -// if (lineText.contains("CLASS")) { -// final class1 = lineText.split('CLASS')[1].trim(); -// extractedData['class'] = class1; -// } -// if (lineText.contains("END")) { -// final end = lineText.split('END')[1].trim(); -// extractedData['end'] = end; -// } -// if (lineText.contains("DD")) { -// final dd = lineText.split('DD')[1].trim(); -// extractedData['dd'] = dd; -// } -// if (lineText.contains("EYES")) { -// final eyes = lineText.split('EYES')[1].trim(); -// extractedData['eyes'] = eyes; -// } -// if (lineText.contains("SEX")) { -// final parts = lineText.split("SEX ")[1]; -// extractedData['sex'] = parts[0]; -// } -// if (lineText.contains("HAIR")) { -// final hair = lineText.split('HAIR')[1].trim(); -// extractedData['hair'] = hair; -// } -// -// if (lineText.contains('STREET') || lineText.contains(',')) { -// final address = lineText; -// extractedData['address'] = address; -// } -// -// // Repeat this process for other relevant data fields -// } -// } -// -// // Convert the list of lines to a JSON string -// jsonOutput = jsonEncode(extractedData); -// decode = jsonDecode(jsonOutput!); -// -// update(); -// print('jsonOutput------------------------------'); -// print(scannedText); -// } -// } - -class ScanDocumentsByApi extends GetxController { - bool isLoading = false; - Map responseMap = {}; - final ImagePicker imagePicker = ImagePicker(); - late Uint8List imagePortrait; - late Uint8List imageSignature; - late Uint8List imageDocumentFrontSide; - XFile? image; - XFile? imagePortraitFile; - XFile? imageFace; - late File tempFile; - late String imagePath; - DateTime now = DateTime.now(); - late String name; - late String licenseClass; - late String documentNo; - late String address; - late String stateCode; - late String height; - late String sex; - late String postalCode; - late String dob; - late String expireDate; - - // /////////////////////// - // late CameraController cameraController; - // late List cameras; - // bool isCameraInitialized = false; - // // final TextRecognizer _textRecognizer = TextRecognizer(); - // String? scannedText; - - // Future initializeCamera(int cameraID) async { - // try { - // cameras = await availableCameras(); - // //update(); - // cameraController = CameraController( - // cameras[cameraID], - // ResolutionPreset.medium, - // enableAudio: false, - // ); - // await cameraController.initialize(); - // isCameraInitialized = true; - // update(); - // } catch (e) { - // if (e is CameraException) { - // switch (e.code) { - // case 'CameraAccessDenied': - // Get.defaultDialog( - // title: 'Camera Access Denied.'.tr, - // middleText: '', - // confirm: - // MyElevatedButton(title: 'Open Settings', onPressed: () {}), - // ); - // break; - // default: - // // Handle other errors here. - // break; - // } - // } - // } - // } - - /// - - Future scanDocumentsByApi() async { - // String? visionApi = await storage.read(key: BoxName.visionApi); - // String? visionApi = AK.visionApi; - // Pick an image from the camera or gallery - // print(visionApi); - image = await imagePicker.pickImage(source: ImageSource.camera); // - - // If no image was picked, return - if (image == null) { - return; - } - - isLoading = true; - update(); - var headers = {'X-BLOBR-KEY': AK.visionApi}; - var request = http.MultipartRequest('POST', - Uri.parse('https://api.faceonlive.com/j2y3q25y1b6maif1/api/iddoc')); - request.files.add(await http.MultipartFile.fromPath('image', image!.path)); - request.headers.addAll(headers); - - http.StreamedResponse response = await request.send(); - - if (response.statusCode == 200) { - String responseString = await response.stream.bytesToString(); - responseMap = jsonDecode(responseString); - var ocrData = responseMap['data']['ocr']; - name = ocrData['name'].toString(); - licenseClass = ocrData['dlClass'].toString(); - documentNo = ocrData['documentNumber'].toString(); - address = ocrData['address'].toString(); - height = ocrData['height'].toString(); - postalCode = ocrData['addressPostalCode'].toString(); - sex = ocrData['sex'].toString(); - stateCode = ocrData['addressJurisdictionCode'].toString(); - expireDate = ocrData['dateOfExpiry'].toString(); - dob = ocrData['dateOfBirth'].toString(); - if (responseMap['data'] != null && - responseMap['data']['image'] != null && - responseMap['data']['image']['portrait'] != null) { - imagePortrait = base64Decode(responseMap['data']['image']['portrait']); - String tempPath = Directory.systemTemp.path; - tempFile = File('$tempPath/image.jpg'); - await tempFile.writeAsBytes(imagePortrait); - - imagePath = tempFile.path; - // imagePortraitFile=File(imagePath) ; - update(); - } else { - // Handle error or provide a default value - } - - if (responseMap['data']['image']['signature'] != null) { - imageSignature = - base64Decode(responseMap['data']['image']['signature']); - } else { - imageSignature = imagePortrait; - // Handle error or provide a default value - } - - if (responseMap['data'] != null && - responseMap['data']['image'] != null && - responseMap['data']['image']['documentFrontSide'] != null) { - imageDocumentFrontSide = - base64Decode(responseMap['data']['image']['documentFrontSide']); - } else { - // Handle error or provide a default value - } - - // print(responseMap); - isLoading = false; - update(); - } else { - print(response.reasonPhrase); - } - } - - late int times; - Future checkMatchFaceApi() async { - sql.getAllData(TableName.faceDetectTimes).then((value) { - if (value.isEmpty || value == null) { - sql.insertData({'faceDetectTimes': 1}, TableName.faceDetectTimes); - sql.getAllData(TableName.faceDetectTimes).then((value) { - times = value[0]['faceDetectTimes']; - update(); - }); - } else { - if (times < 4) { - times++; - matchFaceApi(); - sql.updateData( - {'faceDetectTimes': times}, TableName.faceDetectTimes, 1); - } else { - Get.defaultDialog( - barrierDismissible: false, - title: 'You have finished all times '.tr, - titleStyle: AppStyle.title, - middleText: 'if you want help you can email us here'.tr, - middleTextStyle: AppStyle.title, - cancel: MyElevatedButton( - title: 'Thanks'.tr, - kolor: AppColor.greenColor, - onPressed: () => Get.back(), - ), - confirm: MyElevatedButton( - title: 'Email Us'.tr, - kolor: AppColor.yellowColor, // - onPressed: () { - launchCommunication('email', 'support@mobile-app.store', - '${'Hi'.tr} ${AppInformation.appName}\n${'I cant register in your app in face detection '.tr}'); - Get.back(); - }, - )); - } - } - }); - } - - Map res = {}; - Future matchFaceApi() async { - // String? visionApi = await storage.read(key: BoxName.visionApi); - imageFace = await imagePicker.pickImage( - source: ImageSource.camera, - preferredCameraDevice: CameraDevice.front, - ); - - // If no image was picked, return - if (image == null) { - return; - } - final imageFile = File(imageFace!.path); - // Uint8List imageBytes = await imageFile.readAsBytes(); - var headers = {'X-BLOBR-KEY': AK.visionApi}; - var request = http.MultipartRequest( - 'POST', - Uri.parse( - 'https://api.faceonlive.com/sntzbspfsdupgid1/api/face_compare')); - request.files - .add(await http.MultipartFile.fromPath('image1', imageFile.path)); - request.files.add(await http.MultipartFile.fromPath('image2', imagePath)); - request.headers.addAll(headers); - - http.StreamedResponse response = await request.send(); - print('Request: ${request.toString()}'); - print('Response Status Code: ${response.statusCode}'); - print('Response Reason Phrase: ${response.reasonPhrase}'); - - if (response.statusCode == 200) { - res = jsonDecode(await response.stream.bytesToString()); - print(res); - - update(); - res['data']['result'].toString().contains('No face detected in image') - ? Get.defaultDialog( - barrierDismissible: false, - title: 'No face detected'.tr, - middleText: ''.tr, - titleStyle: AppStyle.title, - confirm: MyElevatedButton( - kolor: AppColor.yellowColor, - title: 'Back'.tr, - onPressed: () { - Get.back(); - }, - )) // - : Get.defaultDialog( - // barrierDismissible: false, - title: 'Image detecting result is '.tr, - titleStyle: AppStyle.title, - content: Column( - children: [ - Text( - res['data']['result'].toString(), - style: res['data']['result'].toString() == 'Different' - ? AppStyle.title.copyWith(color: AppColor.redColor) - : AppStyle.title.copyWith(color: AppColor.greenColor), - ), - res['data']['result'].toString() == 'Different' - ? Text( - '${'Be sure for take accurate images please\nYou have'.tr} $times ${'from 3 times Take Attention'.tr}', - style: AppStyle.title, - ) - : Text( - 'image verified'.tr, - style: AppStyle.title, - ) - ], - ), - confirm: res['data']['result'].toString() == 'Different' - ? MyElevatedButton( - title: 'Back'.tr, - onPressed: () => Get.back(), - kolor: AppColor.redColor, - ) - : MyElevatedButton( - title: 'Next'.tr, - onPressed: () async { - RegisterCaptainController registerCaptainController = - Get.put(RegisterCaptainController()); - - await registerCaptainController.register(); - await registerCaptainController.addLisence(); - await uploadImagePortrate(); - // Get.to(() => CarLicensePage()); - }, - // { - // await uploadImage( - // tempFile, AppLink.uploadImagePortrate); - // Get.to(() => CarLicensePage()); - // }, - kolor: AppColor.greenColor, - )); - } else { - print(response.reasonPhrase); - } - } - - // Todo upload images and fields - Future uploadImagePortrate() async { - isLoading = true; - update(); - - var request = http.MultipartRequest( - 'POST', - Uri.parse(AppLink.uploadImagePortrate), - ); - - request.files.add( - http.MultipartFile.fromBytes('image', imagePortrait), - ); - - request.headers.addAll({ - "Content-Type": "multipart/form-data", - 'Authorization': - 'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}', - }); - request.fields['driverID'] = box.read(BoxName.driverID).toString(); - - var response = await request.send(); - - var responseData = await response.stream.toBytes(); - var responseString = String.fromCharCodes(responseData); - - isLoading = false; - update(); - - // Print the response string - print(responseString); - - return responseString; - } - - @override - void onInit() { - // scanDocumentsByApi(); - // initializeCamera(0); - sql.getAllData(TableName.faceDetectTimes).then((value) { - if (value.isEmpty) { - print(value); - times = 0; - print(times); - update(); - // sql.insertData({'faceDetectTimes': 1}, TableName.faceDetectTimes); - } else { - times = value[0]['faceDetectTimes']; - } - }); - super.onInit(); - } -} - -// class PassportDataExtractor extends GetxController { -// @override -// void onInit() { -// extractPassportData(); -// super.onInit(); -// } -// -// final ImagePicker _imagePicker = ImagePicker(); -// late final XFile? image; -// final TextRecognizer _textRecognizer = TextRecognizer(); -// -// Future> extractPassportData() async { -// image = await _imagePicker.pickImage(source: ImageSource.gallery); -// update(); -// if (image == null) { -// throw Exception('No image picked'); -// } -// -// final InputImage inputImage = InputImage.fromFile(File(image!.path)); -// final RecognizedText recognisedText = -// await _textRecognizer.processImage(inputImage); -// -// final Map extractedData = {}; -// final List> extractedTextWithCoordinates = []; -// -// for (TextBlock block in recognisedText.blocks) { -// for (TextLine line in block.lines) { -// final String lineText = line.text; -// final Rect lineBoundingBox = line.boundingBox!; -// -// extractedTextWithCoordinates.add({ -// 'text': lineText, -// 'boundingBox': { -// 'left': lineBoundingBox.left, -// 'top': lineBoundingBox.top, -// 'width': lineBoundingBox.width, -// 'height': lineBoundingBox.height, -// }, -// }); -// -// // if (lineText.contains('Passport Number')) { -// // final String passportNumber = -// // lineText.split('Passport Number')[1].trim(); -// // extractedData['passportNumber'] = passportNumber; -// // } -// // if (lineText.contains('Given Names')) { -// // final String givenNames = lineText.split('Given Names')[1].trim(); -// // extractedData['givenNames'] = givenNames; -// // } -// // if (lineText.contains('Surname')) { -// // final String surname = lineText.split('Surname')[1].trim(); -// // extractedData['surname'] = surname; -// // } -// // if (lineText.contains('Nationality')) { -// // final String nationality = lineText.split('Nationality')[1].trim(); -// // extractedData['nationality'] = nationality; -// // } -// // if (lineText.contains('Date of Birth')) { -// // final String dob = lineText.split('Date of Birth')[1].trim(); -// // extractedData['dateOfBirth'] = dob; -// // } -// // Add more field extraction conditions as needed -// } -// } -// -// extractedData['extractedTextWithCoordinates'] = -// extractedTextWithCoordinates; -// print(jsonEncode(extractedData)); -// return extractedData; -// } -// } -// -// class PassportDataController extends GetxController { -// PassportDataExtractor passportDataExtractor = PassportDataExtractor(); -// List> extractedTextWithCoordinates = []; -// -// Future extractDataAndDrawBoundingBoxes() async { -// try { -// Map extractedData = -// await passportDataExtractor.extractPassportData(); -// extractedTextWithCoordinates = -// extractedData['extractedTextWithCoordinates']; -// update(); // Notify GetX that the state has changed -// print(extractedTextWithCoordinates); -// } catch (e) { -// print('Passport data extraction failed: $e'); -// } -// } -// } -// -// class BoundingBoxPainter extends CustomPainter { -// final List> boundingBoxes; -// -// BoundingBoxPainter(this.boundingBoxes); -// -// @override -// void paint(Canvas canvas, Size size) { -// final Paint paint = Paint() -// ..color = Colors.red -// ..style = PaintingStyle.stroke -// ..strokeWidth = 2.0; -// -// for (Map boundingBox in boundingBoxes) { -// double left = boundingBox['left']; -// double top = boundingBox['top']; -// double width = boundingBox['width']; -// double height = boundingBox['height']; -// -// Rect rect = Rect.fromLTWH(left, top, width, height); -// canvas.drawRect(rect, paint); -// } -// } -// -// @override -// bool shouldRepaint(covariant CustomPainter oldDelegate) { -// return false; -// } -// } diff --git a/lib/controller/home/captin/duration_controller .dart b/lib/controller/home/captin/duration_controller .dart deleted file mode 100644 index ff12845..0000000 --- a/lib/controller/home/captin/duration_controller .dart +++ /dev/null @@ -1,76 +0,0 @@ -import 'dart:convert'; - -import 'package:fl_chart/fl_chart.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/box_name.dart'; -import 'package:SEFER/constant/links.dart'; -import 'package:SEFER/controller/functions/crud.dart'; -import 'package:SEFER/main.dart'; -import 'package:SEFER/models/model/driver/rides_summary_model.dart'; - -class DurationController extends GetxController { - final data = DurationData; - // late AnimationController animationController; - late List rideData; - Map jsonData1 = {}; - bool isLoading = false; - String totalDurationToday = ''; - var chartData; - - @override - void onInit() async { - super.onInit(); - await fetchData(); - } - - Future fetchData() async { - isLoading = true; - update(); // Notify the observers about the loading state change - - var res = await CRUD().get( - link: AppLink.getTotalDriverDuration, - payload: {'driver_id': box.read(BoxName.driverID)}, - ); - jsonData1 = jsonDecode(res); - var jsonResponse = jsonDecode(res) as Map; - isLoading = false; - // print(jsonResponse); - final List jsonData = jsonResponse['message']; - rideData = jsonData.map((item) { - return MonthlyDataModel.fromJson(item); - }).toList(); - final List spots = rideData - .map((data) => FlSpot( - data.day.toDouble(), - data.totalDuration.toDouble(), - )) - .toList(); - chartData = spots; - - update(); // Notify the observers about the data and loading state change - } - - List parseData(List json) { - return json.map((entry) { - final Map entryMap = entry; - final day = DateTime.parse(entryMap['day']); - final totalDuration = _parseDuration(entryMap['total_duration']); - return DurationData(day, totalDuration); - }).toList(); - } - - Duration _parseDuration(String durationString) { - final parts = durationString.split(':'); - final hours = int.parse(parts[0]); - final minutes = int.parse(parts[1]); - final seconds = int.parse(parts[2]); - return Duration(hours: hours, minutes: minutes, seconds: seconds); - } -} - -class DurationData { - final DateTime day; - final Duration totalDuration; - - DurationData(this.day, this.totalDuration); -} diff --git a/lib/controller/home/captin/help/help_controller.dart b/lib/controller/home/captin/help/help_controller.dart deleted file mode 100644 index 7c70b14..0000000 --- a/lib/controller/home/captin/help/help_controller.dart +++ /dev/null @@ -1,95 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; - -import '../../../../constant/box_name.dart'; -import '../../../../constant/links.dart'; -import '../../../../constant/style.dart'; -import '../../../../main.dart'; -import '../../../../views/widgets/elevated_btn.dart'; -import '../../../functions/crud.dart'; - -class HelpController extends GetxController { - bool isLoading = false; - final formKey = GlobalKey(); - final helpQuestionController = TextEditingController(); - Map helpQuestionDate = {}; - Map helpQuestionRepleyDate = {}; - String status = ''; - String qustion = ''; - late int indexQuestion = 0; - getindex(int i, String qustion1) async { - indexQuestion = i; - qustion = qustion1; - update(); - } - - void addHelpQuestion() async { - isLoading = true; - update(); - var res = await CRUD().post(link: AppLink.addhelpCenter, payload: { - 'driverID': box.read(BoxName.driverID).toString(), - 'helpQuestion': helpQuestionController.text - }); - var d = jsonDecode(res); - // print(d); - isLoading = false; - update(); - if (d['status'].toString() == 'success') { - getHelpQuestion(); - // Get.snackbar('Feedback data saved successfully'.tr, '', - // backgroundColor: AppColor.greenColor, - // snackPosition: SnackPosition.BOTTOM); - } - } - - void getHelpQuestion() async { - isLoading = true; - update(); - var res = await CRUD().get(link: AppLink.gethelpCenter, payload: { - 'driverID': box.read(BoxName.driverID).toString(), - }); - if (res == "failure") { - // print(res); - isLoading = false; - update(); - Get.defaultDialog( - title: 'There is no help Question here'.tr, - titleStyle: AppStyle.title, - middleText: '', - confirm: MyElevatedButton( - title: 'Back'.tr, - onPressed: () { - Get.back(); - Get.back(); - })); - } - helpQuestionDate = jsonDecode(res); - isLoading = false; - update(); - } - - Future getHelpRepley(String id) async { - isLoading = true; - update(); - var res = await CRUD().get(link: AppLink.getByIdhelpCenter, payload: { - 'id': id, - }); - print(res); - if (res == "failure") { - status = 'not yet'; - isLoading = false; - update(); - } - helpQuestionRepleyDate = jsonDecode(res); - isLoading = false; - update(); - } - - @override - void onInit() { - getHelpQuestion(); - super.onInit(); - } -} diff --git a/lib/controller/home/captin/home_captain_controller.dart b/lib/controller/home/captin/home_captain_controller.dart deleted file mode 100644 index 0944d1a..0000000 --- a/lib/controller/home/captin/home_captain_controller.dart +++ /dev/null @@ -1,332 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:SEFER/constant/box_name.dart'; -import 'package:SEFER/controller/home/captin/map_driver_controller.dart'; -import 'dart:async'; - -import '../../../constant/links.dart'; -import '../../../constant/style.dart'; -import '../../../constant/table_names.dart'; -import '../../../main.dart'; -import '../../../views/home/my_wallet/walet_captain.dart'; -import '../../../views/widgets/elevated_btn.dart'; -import '../../functions/crud.dart'; -import '../../functions/location_background_controller.dart'; -import '../../functions/location_controller.dart'; -import '../payment/captain_wallet_controller.dart'; - -class HomeCaptainController extends GetxController { - bool isActive = false; - DateTime? activeStartTime; - Duration activeDuration = Duration.zero; - Timer? activeTimer; - Map data = {}; - bool isLoading = true; - late double kazan; - double latePrice = 0; - double heavyPrice = 0; - double comfortPrice = 0, - speedPrice = 0, - deliveryPrice = 0, - mashwariPrice = 0, - fuelPrice = 0; - double naturePrice = 0; - bool isCallOn = false; - String totalMoneyToday = '0'; - double? rating = 5; - String rideId = '0'; - String countRideToday = '0'; - String totalMoneyInSEFER = '0'; - String totalDurationToday = '0'; - Timer? timer; - late LatLng myLocation = const LatLng(32, 36); - String totalPoints = '0'; - String countRefuse = '0'; - bool mapType = false; - bool mapTrafficON = false; - double widthMapTypeAndTraffic = 50; -// Inject the LocationController class - final locationController = Get.put(LocationController()); - // final locationBackController = Get.put(LocationBackgroundController()); - String formatDuration(Duration duration) { - String twoDigits(int n) => n.toString().padLeft(2, "0"); - String twoDigitMinutes = twoDigits(duration.inMinutes.remainder(60)); - String twoDigitSeconds = twoDigits(duration.inSeconds.remainder(60)); - return "${duration.inHours}:$twoDigitMinutes:$twoDigitSeconds"; - } - - void goToWalletFromConnect() { - Get.back(); - Get.back(); - Get.to(() => WalletCaptain()); - } - - void changeRideId() { - rideId = 'rideId'; - update(); - } - - String stringActiveDuration = ''; - void onButtonSelected() { - // totalPoints = Get.find().totalPoints; - - isActive = !isActive; - if (isActive) { - if (double.parse(totalPoints) > -300) { - locationController.startLocationUpdates(); - // locationBackController.startBackLocation(); - activeStartTime = DateTime.now(); - activeTimer = Timer.periodic(const Duration(seconds: 1), (timer) { - activeDuration = DateTime.now().difference(activeStartTime!); - stringActiveDuration = formatDuration(activeDuration); - update(); - }); - } else { - locationController.stopLocationUpdates(); - - activeStartTime = null; - activeTimer?.cancel(); - savePeriod(activeDuration); - activeDuration = Duration.zero; - update(); - } - } else { - locationController.stopLocationUpdates(); - - activeStartTime = null; - activeTimer?.cancel(); - savePeriod(activeDuration); - activeDuration = Duration.zero; - update(); - } - // } - } - - void getRefusedOrderByCaptain() async { - DateTime today = DateTime.now(); - int todayDay = today.day; - - String driverId = box.read(BoxName.driverID).toString(); - - String customQuery = ''' - SELECT COUNT(*) AS count - FROM ${TableName.driverOrdersRefuse} - WHERE driver_id = '$driverId' - AND created_at LIKE '%$todayDay%' - '''; - - try { - List> results = - await sql.getCustomQuery(customQuery); - countRefuse = results[0]['count'].toString(); - update(); - if (int.parse(countRefuse) > 3 || double.parse(totalPoints) <= -300) { - print('total point is $totalPoints'); - locationController.stopLocationUpdates(); - activeStartTime = null; - activeTimer?.cancel(); - savePeriod(activeDuration); - activeDuration = Duration.zero; - update(); - - Get.defaultDialog( - // backgroundColor: CupertinoColors.destructiveRed, - barrierDismissible: false, - title: 'You Are Stopped For this Day !'.tr, - content: Text( - 'You Refused 3 Rides this Day that is the reason \nSee you Tomorrow!' - .tr, - style: AppStyle.title, - ), - confirm: MyElevatedButton( - title: 'Ok , See you Tomorrow'.tr, - onPressed: () { - Get.back(); - Get.back(); - })); - } - } catch (e) { - print('Error executing custom query: $e'); - } - } - - void changeMapType() { - mapType = !mapType; - // heightButtomSheetShown = isButtomSheetShown == true ? 240 : 0; - update(); - } - - void changeMapTraffic() { - mapTrafficON = !mapTrafficON; - update(); - } - - late GoogleMapController mapHomeCaptainController; - void onMapCreated(GoogleMapController controller) { - mapHomeCaptainController = controller; - controller.getVisibleRegion(); - // Animate camera to user location (optional) - controller.animateCamera( - CameraUpdate.newLatLng(Get.find().myLocation), - ); - } - - void savePeriod(Duration period) { - final periods = box.read>(BoxName.periods) ?? []; - periods.add(period.inSeconds); - box.write(BoxName.periods, periods); - } - - Duration calculateTotalDuration() { - final periods = box.read>(BoxName.periods) ?? []; - Duration totalDuration = Duration.zero; - for (dynamic periodInSeconds in periods) { - final periodDuration = Duration(seconds: periodInSeconds); - totalDuration += periodDuration; - } - return totalDuration; - } - - void startPeriodicExecution() { - Timer.periodic(const Duration(seconds: 30), (timer) async { - await getCaptainDurationOnToday(); - }); - } - - void stopTimer() { - print('Stopping timer'); - timer?.cancel(); - } - - getlocation() async { - isLoading = true; - print('isLoading $isLoading'); - update(); - await Get.find().getLocation(); - isLoading = false; - update(); - } - - @override - void onInit() async { - await addToken(); - await getlocation(); - onButtonSelected(); - await getDriverRate(); - await getKazanPercent(); - await getPaymentToday(); - getCountRideToday(); - getAllPayment(); - startPeriodicExecution(); - onMapCreated(mapHomeCaptainController); - totalPoints = Get.find().totalPoints; - getRefusedOrderByCaptain(); - // LocationController().getLocation(); - super.onInit(); - } - - addToken() async { - await CRUD().post(link: AppLink.addTokensDriver, payload: { - 'token': box.read(BoxName.tokenDriver), - 'captain_id': box.read(BoxName.driverID).toString() - }).then((value) => print('Token Added')); - MapDriverController().driverCallPassenger(); - // box.write(BoxName.statusDriverLocation, 'off'); - } - - getPaymentToday() async { - var res = await CRUD().get( - link: AppLink.getDriverpaymentToday, - payload: {'driverID': box.read(BoxName.driverID).toString()}); - if (res != 'failure') { - data = jsonDecode(res); - totalMoneyToday = data['message'][0]['todayAmount']; - - update(); - } else { - print(res); - } - } - - getKazanPercent() async { - var res = await CRUD().get( - link: AppLink.getKazanPercent, - payload: {'country': box.read(BoxName.countryCode).toString()}, - ); - if (res != 'failure') { - var json = jsonDecode(res); - kazan = double.parse(json['message'][0]['kazan']); - naturePrice = double.parse(json['message'][0]['naturePrice']); - heavyPrice = double.parse(json['message'][0]['heavyPrice']); - latePrice = double.parse(json['message'][0]['latePrice']); - comfortPrice = double.parse(json['message'][0]['comfortPrice']); - speedPrice = double.parse(json['message'][0]['speedPrice']); - deliveryPrice = double.parse(json['message'][0]['deliveryPrice']); - mashwariPrice = double.parse(json['message'][0]['freePrice']); - fuelPrice = double.parse(json['message'][0]['fuelPrice']); - print(json); - } - } - - double mpg = 0; - calculateConsumptionFuel() { - mpg = fuelPrice / 12; //todo in register car add mpg in box - } - - getCountRideToday() async { - var res = await CRUD().get( - link: AppLink.getCountRide, - payload: {'driver_id': box.read(BoxName.driverID).toString()}); - data = jsonDecode(res); - - countRideToday = data['message'][0]['count'].toString(); - // print(countRideToday); - update(); - } - - getDriverRate() async { - var res = await CRUD().get( - link: AppLink.getDriverRate, - payload: {'driver_id': box.read(BoxName.driverID).toString()}); - if (res != 'failure') { - var decod = jsonDecode(res); - if (decod['message'][0]['rating'] != null) { - rating = double.parse(decod['message'][0]['rating'].toString()); - } else { - rating = 5.0; // Set a default value (e.g., 5.0 for full rating) - } - } else { - rating = 5; - } - } - - getAllPayment() async { - var res = await CRUD().get( - link: AppLink.getAllPaymentFromRide, - payload: {'driverID': box.read(BoxName.driverID).toString()}); - data = jsonDecode(res); - - totalMoneyInSEFER = data['message'][0]['total_amount']; - update(); - } - - Future getCaptainDurationOnToday() async { - var res = await CRUD().get( - link: AppLink.getTotalDriverDurationToday, - payload: {'driver_id': box.read(BoxName.driverID).toString()}); - - data = jsonDecode(res); - totalDurationToday = data['message'][0]['total_duration']; - update(); - } - - @override - void dispose() { - activeTimer?.cancel(); - stopTimer(); - super.dispose(); - } -} diff --git a/lib/controller/home/captin/map_driver_controller.dart b/lib/controller/home/captin/map_driver_controller.dart deleted file mode 100644 index e7f596f..0000000 --- a/lib/controller/home/captin/map_driver_controller.dart +++ /dev/null @@ -1,904 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; -import 'dart:math' as math; -import 'dart:math' show cos; -import 'package:SEFER/constant/table_names.dart'; -import 'package:SEFER/controller/home/captin/home_captain_controller.dart'; -import 'package:flutter/material.dart'; -import 'package:geolocator/geolocator.dart'; -import 'package:get/get.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:google_polyline_algorithm/google_polyline_algorithm.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; -import 'package:url_launcher/url_launcher.dart'; - -import '../../../constant/api_key.dart'; -import '../../../constant/box_name.dart'; -import '../../../constant/colors.dart'; -import '../../../constant/links.dart'; -import '../../../main.dart'; -import '../../../views/Rate/rate_passenger.dart'; -import '../../../views/home/Captin/home_captain/home_captin.dart'; -import '../../firebase/firbase_messge.dart'; -import '../../functions/crud.dart'; -import '../../functions/location_controller.dart'; - -class MapDriverController extends GetxController { - bool isLoading = true; - final formKey1 = GlobalKey(); - final sosEmergincyNumberCotroller = TextEditingController(); - List data = []; - List dataDestination = []; - LatLngBounds? boundsData; - BitmapDescriptor carIcon = BitmapDescriptor.defaultMarker; - BitmapDescriptor passengerIcon = BitmapDescriptor.defaultMarker; - BitmapDescriptor startIcon = BitmapDescriptor.defaultMarker; - BitmapDescriptor endIcon = BitmapDescriptor.defaultMarker; - final List polylineCoordinates = []; - final List polylineCoordinatesDestination = []; - List polyLines = []; - List polyLinesDestination = []; - Set markers = {}; - late String passengerLocation; - late String passengerDestination; - late String step0; - late String step1; - late String step2; - late String step3; - late String step4; - late String passengerWalletBurc; - late String timeOfOrder; - late String duration; - late String totalCost; - late String distance; - late String passengerName; - late String passengerEmail; - late String totalPassenger; - late String passengerPhone; - late String rideId; - late String isHaveSteps; - late String paymentAmount; - late String paymentMethod; - late String passengerId; - late String driverId; - late String tokenPassenger; - late String durationToPassenger; - late String walletChecked; - late String direction; - late String durationOfRideValue; - late String status; - int timeWaitingPassenger = 5; //5 miniute - bool isPassengerInfoWindow = false; - bool isBtnRideBegin = false; - bool isArrivedSend = true; - bool isdriverWaitTimeEnd = false; - bool isRideFinished = false; - bool isRideStarted = false; - bool isPriceWindow = false; - double passengerInfoWindowHeight = Get.height * .35; - double driverEndPage = 100; - double progress = 0; - double progressToPassenger = 0; - double progressInPassengerLocationFromDriver = 0; - bool isRideBegin = false; - int progressTimerToShowPassengerInfoWindowFromDriver = 25; - int remainingTimeToShowPassengerInfoWindowFromDriver = 25; - int remainingTimeToPassenger = 60; - int remainingTimeInPassengerLocatioWait = 60; - bool isDriverNearPassengerStart = false; - GoogleMapController? mapController; - late LatLng myLocation; - int remainingTimeTimerRideBegin = 60; - String stringRemainingTimeRideBegin = ''; - String stringRemainingTimeRideBegin1 = ''; - double progressTimerRideBegin = 0; - late Timer timer; - String? mapAPIKEY; - final zones = []; - String canelString = 'yet'; - late LatLng latLngpassengerLocation; - late LatLng latLngPassengerDestination; - - void onMapCreated(GoogleMapController controller) async { - myLocation = Get.find().location as LatLng; - myLocation = myLocation; - mapController = controller; - controller.getVisibleRegion(); - controller.animateCamera( - CameraUpdate.newLatLng(Get.find().myLocation), - ); - update(); - // Set up a timer or interval to trigger the marker update every 3 seconds. - timer = Timer.periodic(const Duration(seconds: 1), (_) { - updateMarker(); - }); - } - - void changeStatusDriver() { - status = 'On'; - update(); - } - - void changeDriverEndPage() { - remainingTimeTimerRideBegin < 60 ? driverEndPage = 160 : 100; - update(); - } - - takeSnapMap() { - mapController!.takeSnapshot(); - } - - @override - void dispose() { - mapController!.dispose(); - super.dispose(); - } - - Future openGoogleMapFromDriverToPassenger() async { - var endLat = latLngpassengerLocation.latitude; - var endLng = latLngpassengerLocation.longitude; - - var startLat = Get.find().myLocation.latitude; - var startLng = Get.find().myLocation.longitude; - - String url = - 'https://www.google.com/maps/dir/$startLat,$startLng/$endLat,$endLng/&directionsmode=driving'; - if (await canLaunchUrl(Uri.parse(url))) { - await launchUrl(Uri.parse(url)); - } else { - throw 'Could not launch google maps'; - } - } - - void clearPolyline() { - polyLines = []; - polyLinesDestination = []; - polylineCoordinates.clear(); - polylineCoordinatesDestination.clear(); - update(); - } - - void changeRideToBeginToPassenger() { - isRideBegin = true; - passengerInfoWindowHeight = Get.height * .22; - update(); - } - - void startTimerToShowPassengerInfoWindowFromDriver() async { - isPassengerInfoWindow = true; - for (int i = 0; i <= int.parse(durationToPassenger); i++) { - await Future.delayed(const Duration(seconds: 1)); - progressToPassenger = i / int.parse(durationToPassenger); - remainingTimeToPassenger = int.parse(durationToPassenger) - i; - if (remainingTimeToPassenger == 0) { - isBtnRideBegin = true; - print(isBtnRideBegin); - update(); - } - print(isBtnRideBegin); - print(remainingTimeToPassenger); - - int minutes = (remainingTimeToPassenger / 60).floor(); - int seconds = remainingTimeToPassenger % 60; - stringRemainingTimeToPassenger = - '$minutes:${seconds.toString().padLeft(2, '0')}'; - - update(); - } - // update(); - // startTimerToShowDriverToPassengerDuration(); - } - - String stringRemainingTimeToPassenger = ''; - - String stringRemainingTimeWaitingPassenger = ''; - - void startTimerToShowDriverWaitPassengerDuration() async { - for (int i = 0; i <= timeWaitingPassenger * 60; i++) { - await Future.delayed(const Duration(seconds: 1)); - progressInPassengerLocationFromDriver = i / (timeWaitingPassenger * 60); - remainingTimeInPassengerLocatioWait = (timeWaitingPassenger * 60) - i; - if (isRideBegin == true) { - remainingTimeInPassengerLocatioWait = 0; - update(); - } - if (remainingTimeInPassengerLocatioWait == 0) { - isdriverWaitTimeEnd = true; - print(isdriverWaitTimeEnd); - update(); - } - print(isdriverWaitTimeEnd); - print( - 'remainingTimeInPassengerLocatioWait $remainingTimeInPassengerLocatioWait'); - - int minutes = (remainingTimeInPassengerLocatioWait / 60).floor(); - int seconds = remainingTimeInPassengerLocatioWait % 60; - stringRemainingTimeWaitingPassenger = - '$minutes:${seconds.toString().padLeft(2, '0')}'; - - update(); - } - } - - void driverGoToPassenger() async { - changeRideToBeginToPassenger(); - await CRUD().post(link: AppLink.updateRides, payload: { - 'id': rideId, - 'driverGoToPassengerTime': DateTime.now().toString(), - 'status': 'Applied' - }); - FirebaseMessagesController().sendNotificationToAnyWithoutData( - 'DriverIsGoingToPassenger', - box.read(BoxName.name).toString(), - tokenPassenger); - if (box.read(BoxName.googlaMapApp) == true) { - await openGoogleMapFromDriverToPassenger(); - } - } - - bool isSocialPressed = false; - driverCallPassenger() async { - String scam = await getDriverScam(); - if (scam != 'failure') { - if (int.parse(scam) > 3) { - box.write(BoxName.statusDriverLocation, 'on'); - Get.find().stopLocationUpdates(); - await CRUD().post(link: AppLink.addNotificationCaptain, payload: { - 'driverID': box.read(BoxName.driverID), - 'title': 'scams operations'.tr, - 'body': - 'you have connect to passengers and let them cancel the order'.tr, - }); - } else if (isSocialPressed == true) { - box.write(BoxName.statusDriverLocation, 'off'); - await CRUD().post(link: AppLink.adddriverScam, payload: { - 'driverID': box.read(BoxName.driverID), - 'passengerID': passengerId, - 'rideID': rideId, - 'isDriverCalledPassenger': '$isSocialPressed' - }); - } - } - } - - Future getDriverScam() async { - var res = await CRUD().post(link: AppLink.getdriverScam, payload: { - 'driverID': box.read(BoxName.driverID), - }); - if (res == 'failure') { - print('Scam is failure'); - box.write(BoxName.statusDriverLocation, 'off'); - return '0'; - } - var d = jsonDecode(res); - print('Scam is '); - print(d['message'][0]['count']); - return d['message'][0]['count']; - } - - Position? currentPosition; - - startRideFromDriver() async { - double _distance = - await calculateDistanceBetweenDriverAndPassengerLocation(); - - if (_distance < 50) { - changeRideToBeginToPassenger(); - isPassengerInfoWindow = false; - isRideStarted = true; - isRideFinished = false; - remainingTimeInPassengerLocatioWait = 0; - timeWaitingPassenger = 0; - box.write(BoxName.statusDriverLocation, 'on'); - - update(); - await CRUD().post(link: AppLink.updateRides, payload: { - 'id': rideId, - 'rideTimeStart': DateTime.now().toString(), - 'status': 'Begin', - }); - - FirebaseMessagesController().sendNotificationToAnyWithoutData( - 'RideIsBegin', box.read(BoxName.name).toString(), tokenPassenger); - rideIsBeginPassengerTimer(); - - // var d = jsonDecode(res); - - update(); - // Start updating location and moving camera - // updateLocation(); - } else { - Get.defaultDialog( - barrierDismissible: false, - title: 'Your are far from passenger location'.tr, - middleText: - 'go to your passenger location before\nPassenger cancel trip'.tr, - confirm: MyElevatedButton( - title: 'Ok', - onPressed: () { - Get.back(); - }), - ); - } - } - - calculateDistanceInMeter(LatLng prev, LatLng current) async { - double distance2 = Geolocator.distanceBetween( - prev.latitude, - prev.longitude, - current.latitude, - current.longitude, - ); - return distance2; - } - - double speedoMeter = 0; - void updateLocation() async { - try { - for (var i = 0; i < remainingTimeTimerRideBegin; i++) { - await Future.delayed(const Duration(seconds: 1)); - - mapController!.animateCamera( - CameraUpdate.newCameraPosition( - CameraPosition( - target: myLocation, - zoom: 17, // Adjust zoom level as needed - ), - ), - ); - // }); - update(); - } - - // Stop listening after ride finishes - if (!isRideBegin) {} - } catch (error) { - debugPrint('Error listening to GPS: $error'); - // Handle GPS errors gracefully - } - - // Periodically call updateLocation again - await Future.delayed(const Duration(seconds: 1)); - updateLocation(); - } - - calculateDistanceBetweenDriverAndPassengerLocation() { - double distance2 = Geolocator.distanceBetween( - latLngpassengerLocation.latitude, - latLngpassengerLocation.longitude, - Get.find().myLocation.latitude, - Get.find().myLocation.longitude, - ); - return distance2; - } - - addWaitingTimeCostFromPassengerToDriverWallet() async { - double distance2 = calculateDistanceBetweenDriverAndPassengerLocation(); - - if (distance2 > 40) { - Get.defaultDialog( - title: 'Your are far from passenger location'.tr, - middleText: - 'go to your passenger location before\nPassenger cancel trip'.tr, - confirm: MyElevatedButton( - title: 'Ok', - onPressed: () { - Get.back(); - })); - } else { - double costOfWaiting5Minute = - (distanceBetweenDriverAndPassengerWhenConfirm * .08) + - (5 * 1); //for Eygpt other like jordan .06 per minute - var res = await CRUD().post(link: AppLink.addDriverpayment, payload: { - 'rideId': rideId, - 'amount': costOfWaiting5Minute.toString(), - 'payment_method': 'wait-cancel', - 'passengerID': passengerId, - 'driverID': box.read(BoxName.driverID).toString(), - }); - if (res != 'failure') { - Get.snackbar( - 'You will get cost of your work for this trip'.tr, - '${'you gain'.tr} $costOfWaiting5Minute \$${' in your wallet'.tr}', - backgroundColor: AppColor.deepPurpleAccent, - ); - } - await CRUD().post(link: AppLink.addPassengersWallet, payload: { - 'passenger_id': passengerId, - 'balance': (costOfWaiting5Minute * -1).toString() - }); - box.write(BoxName.statusDriverLocation, 'off'); - Get.offAll(HomeCaptain()); - } - } - - void finishRideFromDriver() { - Get.defaultDialog( - title: 'Are you sure to exit ride ?'.tr, - titleStyle: AppStyle.title, - middleText: '', - confirm: MyElevatedButton( - title: 'Ok'.tr, - kolor: AppColor.greenColor, - onPressed: () { - Get.back(); - finishRideFromDriver1(); - }), - cancel: MyElevatedButton( - title: 'Cancel'.tr, - kolor: Colors.red, - onPressed: () { - Get.back(); - })); - } - - void finishRideFromDriver1() async { - double distanceToDestination = Geolocator.distanceBetween( - latLngPassengerDestination.latitude, - latLngPassengerDestination.longitude, - Get.find().myLocation.latitude, - Get.find().myLocation.longitude, - ); - // if (carType != 'Comfort' || carType != 'Free Ride') { - // if (distanceToDestination < 50) { - isRideFinished = true; - isRideStarted = false; - isPriceWindow = false; - totalCost = carType != 'Comfort' && carType != 'Mashwari' - ? totalPassenger - : price < double.parse(totalPassenger) - ? totalPassenger - : price.toStringAsFixed(2); - paymentAmount = totalCost; - box.write(BoxName.statusDriverLocation, 'off'); - // changeRideToBeginToPassenger(); - await CRUD().post(link: AppLink.updateRides, payload: { - 'id': rideId, - 'rideTimeFinish': DateTime.now().toString(), - 'status': 'Finished', - 'price': totalCost, - }); - print('walletChecked is $walletChecked'); - if (walletChecked == 'true') { - await CRUD().post(link: AppLink.addPassengersWallet, payload: { - 'passenger_id': passengerId, - 'balance': ((-1) * double.parse(paymentAmount)).toString() - }); - } - await CRUD().post(link: AppLink.addDriverpayment, payload: { - 'rideId': rideId, - 'amount': paymentAmount, - 'payment_method': paymentMethod, - 'passengerID': passengerId, - 'driverID': box.read(BoxName.driverID).toString(), - }); - print('passengerWalletBurc bef ${double.parse(passengerWalletBurc)}'); - if (double.parse(passengerWalletBurc) < 0) { - await CRUD().post(link: AppLink.addPassengersWallet, payload: { - 'passenger_id': passengerId, - 'balance': ((-1) * double.parse(passengerWalletBurc)).toString() - }); - print('passengerWalletBurc aft ${double.parse(passengerWalletBurc)}'); - } - - double pointsSubstraction = 0; - pointsSubstraction = double.parse(paymentAmount) * - (-1) * - double.parse(kazan) / - 100; // for eygpt /100 - var res = await CRUD().post(link: AppLink.addDriversWalletPoints, payload: { - 'paymentID': 'rideId$rideId', - 'amount': (pointsSubstraction).toStringAsFixed(0), - 'paymentMethod': paymentMethod, - 'driverID': box.read(BoxName.driverID).toString(), - }); - print(res); - Future.delayed(const Duration(milliseconds: 300)); - FirebaseMessagesController().sendNotificationToPassengerToken( - 'Driver Finish Trip', - '${'you will pay to Driver'.tr} $paymentAmount \$', - tokenPassenger, - [ - box.read(BoxName.driverID), - rideId, - box.read(BoxName.tokenDriver), - // carType == 'Comfort' || carType == 'Mashwari' - // ? price.toStringAsFixed(2) - // : totalPassenger - paymentAmount.toString() - ], - ); - Get.to(() => RatePassenger(), arguments: { - 'passengerId': passengerId, - 'rideId': rideId, - 'price': price.toString(), - }); - // Get.back(); - } - - void cancelCheckRideFromPassenger() async { - var res = await CRUD().get(link: AppLink.getOrderCancelStatus, payload: { - 'order_id': rideId, - }); //.then((value) { - print('Cancel fetch--------------------'); - var response = jsonDecode(res); - canelString = response['data']['status']; - print('cancel is $canelString'); - update(); - if (canelString == 'Cancel') { - remainingTimeTimerRideBegin = 0; - remainingTimeToShowPassengerInfoWindowFromDriver = 0; - remainingTimeToPassenger = 0; - isRideStarted = false; - isRideFinished = false; - isPassengerInfoWindow = false; - clearPolyline(); - update(); - Get.defaultDialog( - title: 'Order Cancelled'.tr, - titleStyle: AppStyle.title, - middleText: 'Order Cancelled by Passenger'.tr, - middleTextStyle: AppStyle.title, - confirm: MyElevatedButton( - title: 'Ok'.tr, - onPressed: () { - Get.offAll(HomeCaptain()); - }, - ), - ); - } - } - - int rideTimerFromBegin = 0; - double price = 0; - void rideIsBeginPassengerTimer() async { - // print('mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm'); - // print(durationOfRideValue); - int durationOfRide = int.parse(durationOfRideValue); - update(); - int infinity = 40000; - if (carType == 'Comfort' || carType == 'Mashwari') { - durationOfRide = infinity; - update(); - } - for (int i = 0; i <= durationOfRide; i++) { - await Future.delayed(const Duration(seconds: 1)); - recentDistanceToDash = Get.find().totalDistance; - rideTimerFromBegin = i; - price = carType == 'Comfort' // || carType == 'Free Ride' - ? (i ~/ 60) + - (recentDistanceToDash * - Get.find().comfortPrice) - : carType == 'Speed' - ? (i ~/ 60) + - (recentDistanceToDash * - Get.find().speedPrice) - : carType == 'Mashwari' - ? (i ~/ 60) + - (recentDistanceToDash * - Get.find().deliveryPrice) - : (i ~/ 60) + - (recentDistanceToDash * - Get.find() - .mashwariPrice); // $1 for each minute + $4 for each km - price = (price * .10) + price; // Add 10% tax - speed = Get.find().speed * 3.6; - progressTimerRideBegin = i / durationOfRide; - remainingTimeTimerRideBegin = durationOfRide - i; - remainingTimeTimerRideBegin < 60 ? driverEndPage = 160 : 100; - updateMarker(); - if (remainingTimeTimerRideBegin < 120) { - // to make driver available on last 2 minute in his trip - box.write(BoxName.statusDriverLocation, 'off'); - } - int minutes = (remainingTimeTimerRideBegin / 60).floor(); - int seconds = remainingTimeTimerRideBegin % 60; - stringRemainingTimeRideBegin = - '$minutes:${seconds.toString().padLeft(2, '0')}'; - int minutes1 = (i / 60).floor(); - int seconds1 = i % 60; - stringRemainingTimeRideBegin1 = - '$minutes1:${seconds1.toString().padLeft(2, '0')}'; - update(); - } - } - - double recentDistanceToDash = 0; - double recentAngelToMarker = 0; - double speed = 0; - void updateMarker() async { - // Remove the existing marker with the ID `MyLocation`. - markers.remove(MarkerId('MyLocation')); - - // Add a new marker with the ID `MyLocation` at the current location of the user. - LocationController locationController = Get.find(); - myLocation = locationController.myLocation; - - markers.add( - Marker( - markerId: MarkerId('MyLocation'.tr), - position: myLocation, - draggable: true, - icon: carIcon, - rotation: locationController.heading, - // infoWindow: const InfoWindow( - // title: 'Time', - // ), - ), - ); - - // Animate camera only once after updating the marker - // mapController!.animateCamera( - // CameraUpdate.newLatLng(myLocation), - // ); - update(); - } - - void addCustomCarIcon() { - ImageConfiguration config = ImageConfiguration( - size: const Size(30, 30), devicePixelRatio: Get.pixelRatio - // scale: 1.0, - ); - BitmapDescriptor.fromAssetImage(config, 'assets/images/car.png', - mipmaps: false) - .then((value) { - carIcon = value; - update(); - }); - } - - void addCustomStartIcon() async { -// Create the marker with the resized image - - ImageConfiguration config = ImageConfiguration( - size: const Size(30, 30), devicePixelRatio: Get.pixelRatio); - BitmapDescriptor.fromAssetImage(config, 'assets/images/A.png', - mipmaps: false) - .then((value) { - startIcon = value; - update(); - }); - } - - void addCustomEndIcon() { - ImageConfiguration config = ImageConfiguration( - size: const Size(25, 25), devicePixelRatio: Get.pixelRatio); - BitmapDescriptor.fromAssetImage(config, 'assets/images/b.png', - mipmaps: false) - .then((value) { - endIcon = value; - update(); - }); - } - - void addCustomPassengerIcon() { - ImageConfiguration config = ImageConfiguration( - size: const Size(30, 30), devicePixelRatio: Get.pixelRatio - // scale: 1.0, - ); - BitmapDescriptor.fromAssetImage(config, 'assets/images/picker.png', - mipmaps: false) - .then((value) { - passengerIcon = value; - update(); - }); - } - - double distanceBetweenDriverAndPassengerWhenConfirm = 0; - getMap(String origin, destination) async { - isLoading = false; - - update(); - - var url = - ('${AppLink.googleMapsLink}directions/json?&language=${box.read(BoxName.lang)}&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AK.mapAPIKEY}'); - - var response = await CRUD().getGoogleApi(link: url, payload: {}); - data = response['routes'][0]['legs']; - print(data); - distanceBetweenDriverAndPassengerWhenConfirm = - (data[0]['distance']['value']) / 1000; - final points = - decodePolyline(response["routes"][0]["overview_polyline"]["points"]); - for (int i = 0; i < points.length; i++) { - double lat = points[i][0].toDouble(); - double lng = points[i][1].toDouble(); - polylineCoordinates.add(LatLng(lat, lng)); - } - if (polyLines.isNotEmpty) { - clearPolyline(); - var polyline = Polyline( - polylineId: PolylineId(response["routes"][0]["summary"]), - points: polylineCoordinates, - width: 10, - color: AppColor.blueColor, - ); - polyLines.add(polyline); - // rideConfirm = false; - update(); - } else { - var polyline = Polyline( - polylineId: PolylineId(response["routes"][0]["summary"]), - points: polylineCoordinates, - width: 10, - color: AppColor.blueColor, - ); - // final dataBounds = response["routes"][0]["bounds"]; - - // updateCameraFromBoundsAfterGetMap(dataBounds); - -// Fit the camera to the bounds - - polyLines.add(polyline); - // rideConfirm = false; - // Define the northeast and southwest coordinates - final bounds = response["routes"][0]["bounds"]; - LatLng northeast = - LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']); - LatLng southwest = - LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']); - -// Create the LatLngBounds object - LatLngBounds boundsData = - LatLngBounds(northeast: northeast, southwest: southwest); - -// Fit the camera to the bounds - var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 140); - mapController!.animateCamera(cameraUpdate); - update(); - } - } - - getMapDestination(String origin, destination) async { - var url = - ('${AppLink.googleMapsLink}directions/json?&language=${box.read(BoxName.lang)}&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AK.mapAPIKEY}'); - - var response = await CRUD().getGoogleApi(link: url, payload: {}); - dataDestination = response['routes'][0]['legs']; - // print(data); - final points = - decodePolyline(response["routes"][0]["overview_polyline"]["points"]); - for (int i = 0; i < points.length; i++) { - double lat = points[i][0].toDouble(); - double lng = points[i][1].toDouble(); - polylineCoordinatesDestination.add(LatLng(lat, lng)); - } - if (polyLinesDestination.isNotEmpty) { - // clearPolyline(); - var polyline = Polyline( - polylineId: PolylineId(response["routes"][0]["summary"]), - points: polylineCoordinatesDestination, - width: 10, - color: AppColor.redColor, - ); - polyLinesDestination.add(polyline); - // rideConfirm = false; - update(); - } else { - var polyline = Polyline( - polylineId: PolylineId(response["routes"][0]["summary"]), - points: polylineCoordinatesDestination, - width: 10, - color: AppColor.redColor, - ); - // final dataBounds = response["routes"][0]["bounds"]; - - // updateCameraFromBoundsAfterGetMap(dataBounds); - // polyLinesDestination.add(polyline); - // rideConfirm = false; - // Define the northeast and southwest coordinates - - update(); - } - } - - void updateCameraFromBoundsAfterGetMap(dynamic response) { - final bounds = response["routes"][0]["bounds"]; - LatLng northeast = - LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']); - LatLng southwest = - LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']); - -// Create the LatLngBounds object - LatLngBounds boundsData = - LatLngBounds(northeast: northeast, southwest: southwest); - -// Fit the camera to the bounds - var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 140); - mapController!.animateCamera(cameraUpdate); - } - - void changePassengerInfoWindow() { - isPassengerInfoWindow = !isPassengerInfoWindow; - passengerInfoWindowHeight = isPassengerInfoWindow == true ? 200 : 0; - update(); - } - - double mpg = 0; - calculateConsumptionFuel() { - mpg = Get.find().fuelPrice / - 12; //todo in register car add mpg in box - update(); - } - - late Duration durationToAdd; - int hours = 0; - int minutes = 0; - late String carType; - late String kazan; - @override - void onInit() async { - mapAPIKEY = await storage.read(key: BoxName.mapAPIKEY); - // Get the passenger location from the arguments. - passengerLocation = Get.arguments['passengerLocation']; - passengerDestination = Get.arguments['passengerDestination']; - duration = Get.arguments['Duration']; - totalCost = Get.arguments['totalCost']; - passengerId = Get.arguments['passengerId']; - driverId = Get.arguments['driverId']; - distance = Get.arguments['Distance']; - passengerName = Get.arguments['name']; - passengerEmail = Get.arguments['email']; - totalPassenger = Get.arguments['totalPassenger']; - passengerPhone = Get.arguments['phone']; - walletChecked = Get.arguments['WalletChecked']; - tokenPassenger = Get.arguments['tokenPassenger']; - direction = Get.arguments['direction']; - durationToPassenger = Get.arguments['DurationToPassenger']; - rideId = Get.arguments['rideId']; - durationOfRideValue = Get.arguments['durationOfRideValue']; - paymentAmount = Get.arguments['paymentAmount']; - paymentMethod = Get.arguments['paymentMethod']; - isHaveSteps = Get.arguments['isHaveSteps']; - step0 = Get.arguments['step0']; - step1 = Get.arguments['step1']; - step2 = Get.arguments['step2']; - step3 = Get.arguments['step3']; - step4 = Get.arguments['step4']; - passengerWalletBurc = Get.arguments['passengerWalletBurc']; - timeOfOrder = Get.arguments['timeOfOrder']; - carType = Get.arguments['carType']; - kazan = Get.arguments['kazan']; - - var coords = passengerLocation.split(','); - var coordDestination = passengerDestination.split(','); - -// Parse to double - double latPassengerLocation = double.parse(coords[0]); - double lngPassengerLocation = double.parse(coords[1]); - double latPassengerDestination = double.parse(coordDestination[0]); - double lngPassengerDestination = double.parse(coordDestination[1]); - latLngpassengerLocation = - LatLng(latPassengerLocation, lngPassengerLocation); - latLngPassengerDestination = - LatLng(latPassengerDestination, lngPassengerDestination); - String lat = Get.find().myLocation.latitude.toString(); - String lng = Get.find().myLocation.longitude.toString(); - String origin = '$lat,$lng'; - // Set the origin and destination coordinates for the Google Maps directions request. - getMap(origin, passengerLocation); - isHaveSteps == 'haveSteps' - ? ( - await getMapDestination(step0, step1), - await getMapDestination(step1, step2), - step3 == '' ? await getMapDestination(step2, step3) : () {}, - step4 == '' ? await getMapDestination(step3, step4) : () {}, - ) - : await getMapDestination(passengerLocation, passengerDestination); - addCustomCarIcon(); - addCustomPassengerIcon(); - addCustomStartIcon(); - addCustomEndIcon(); - // updateMarker(); - // updateLocation(); - startTimerToShowPassengerInfoWindowFromDriver(); - durationToAdd = Duration(seconds: int.parse(duration)); - hours = durationToAdd.inHours; - minutes = (durationToAdd.inMinutes % 60).round(); - calculateConsumptionFuel(); - // cancelCheckRidefromPassenger(); - // checkIsDriverNearPassenger(); - super.onInit(); - } -} diff --git a/lib/controller/home/captin/order_request_controller.dart b/lib/controller/home/captin/order_request_controller.dart deleted file mode 100644 index 5a58020..0000000 --- a/lib/controller/home/captin/order_request_controller.dart +++ /dev/null @@ -1,178 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/links.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/main.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; - -import '../../../constant/box_name.dart'; -import '../../../constant/table_names.dart'; -import '../../functions/crud.dart'; -import '../../functions/location_controller.dart'; -import 'home_captain_controller.dart'; - -class OrderRequestController extends GetxController { - double progress = 0; - double progressSpeed = 0; - int duration = 11; - int durationSpeed = 20; - int remainingTime = 0; - int remainingTimeSpeed = 0; - String countRefuse = '0'; - bool applied = false; - final locationController = Get.put(LocationController()); - - @override - void onInit() { - getRefusedOrderByCaptain(); - // calculateConsumptionFuel(); - update(); - super.onInit(); - } - - void changeApplied() { - applied = true; - update(); - } - - double mpg = 0; - calculateConsumptionFuel() { - mpg = Get.find().fuelPrice / - 12; //todo in register car add mpg in box - } - - void getRefusedOrderByCaptain() async { - DateTime today = DateTime.now(); - int todayDay = today.day; - - String driverId = box.read(BoxName.driverID).toString(); - - String customQuery = ''' - SELECT COUNT(*) AS count - FROM ${TableName.driverOrdersRefuse} - WHERE driver_id = '$driverId' - AND created_at LIKE '%$todayDay%' - '''; - - try { - List> results = - await sql.getCustomQuery(customQuery); - countRefuse = results[0]['count'].toString(); - update(); - if (int.parse(countRefuse) > 3) { - locationController.stopLocationUpdates(); - Get.defaultDialog( - // backgroundColor: CupertinoColors.destructiveRed, - barrierDismissible: false, - title: 'You Are Stopped For this Day !'.tr, - content: Text( - 'You Refused 3 Rides this Day that is the reason \nSee you Tomorrow!' - .tr, - style: AppStyle.title, - ), - confirm: MyElevatedButton( - title: 'Ok , See you Tomorrow'.tr, - onPressed: () => Get.back())); - } - } catch (e) { - print('Error executing custom query: $e'); - } - } - - void startTimer(String driverID, orderID) async { - for (int i = 0; i <= duration; i++) { - await Future.delayed(const Duration(seconds: 1)); - progress = i / duration; - remainingTime = duration - i; - - update(); - } - if (remainingTime == 0) { - if (applied == false) { - print('applied========================='); - print(applied); - refuseOrder(orderID); - } - } - } - - void startTimerSpeed(String driverID, orderID) async { - for (int i = 0; i <= durationSpeed; i++) { - await Future.delayed(const Duration(seconds: 1)); - progressSpeed = i / durationSpeed; - remainingTimeSpeed = durationSpeed - i; - - update(); - } - // if (remainingTimeSpeed == 0) { - // if (applied == false) { - // print('applied========================='); - // print(applied); - // Get.back(); - // // refuseOrder(box.read(BoxName.driverID), orderID); - // } - // } - } - - void refuseOrder( - orderID, - ) async { - await CRUD().postFromDialogue(link: AppLink.addDriverOrder, payload: { - //TODO need review - 'driver_id': box.read(BoxName.driverID), - // box.read(BoxName.driverID).toString(), - 'order_id': orderID, - 'status': 'Refused' - }); - await CRUD().post(link: AppLink.updateRides, payload: { - 'id': orderID, - 'rideTimeStart': DateTime.now().toString(), - 'status': 'Refused', - 'driver_id': box.read(BoxName.driverID), - }); - - // applied = true; - sql.insertData({ - 'order_id': orderID, - 'created_at': DateTime.now().toString(), - 'driver_id': box.read(BoxName.driverID).toString(), - }, TableName.driverOrdersRefuse); - getRefusedOrderByCaptain(); - box.write(BoxName.statusDriverLocation, 'off'); - update(); - Get.back(); - // Get.offAll(HomeCaptain()); - } - - addRideToNotificationDriverString( - orderID, - String startLocation, - String endLocation, - String date, - String time, - String price, - String passengerId, - String status, - String carType, - String passengerRate, - String priceForPassenger, - String distance, - String duration, - ) async { - await CRUD().post(link: AppLink.addWaitingRide, payload: { - 'id': orderID, - 'start_location': startLocation, - 'end_location': endLocation, - 'date': date, - 'time': time, - 'price': price, - 'passenger_id': passengerId, - 'status': status, - 'carType': carType, - 'passengerRate': passengerRate, - 'price_for_passenger': priceForPassenger, - 'distance': distance, - 'duration': duration, - }); - } -} diff --git a/lib/controller/home/splash_screen_controlle.dart b/lib/controller/home/splash_screen_controlle.dart index b09c927..1f9efe0 100644 --- a/lib/controller/home/splash_screen_controlle.dart +++ b/lib/controller/home/splash_screen_controlle.dart @@ -7,8 +7,6 @@ import 'package:SEFER/views/auth/login_page.dart'; import '../../constant/box_name.dart'; import '../../main.dart'; import '../../onbording_page.dart'; -import '../../views/auth/captin/login_captin.dart'; -import '../../views/home/Captin/home_captain/home_captin.dart'; import '../../views/home/map_page_passenger.dart'; class SplashScreenController extends GetxController @@ -50,11 +48,7 @@ class SplashScreenController extends GetxController ? Get.off(() => OnBoardingPage()) : box.read(BoxName.email) != null ? Get.off(() => const MapPagePassenger()) - : box.read(BoxName.emailDriver) == null - ? Get.off(() => LoginPage()) - : box.read(BoxName.emailDriver) != null - ? Get.off(() => HomeCaptain()) - : Get.off(() => LoginCaptin()); + : Get.off(() => LoginPage()); }); } diff --git a/lib/controller/rate/rate_conroller.dart b/lib/controller/rate/rate_conroller.dart index f4aa324..69db08e 100644 --- a/lib/controller/rate/rate_conroller.dart +++ b/lib/controller/rate/rate_conroller.dart @@ -1,5 +1,3 @@ -import 'package:SEFER/controller/home/captin/map_driver_controller.dart'; -import 'package:SEFER/views/home/home_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:get/get.dart'; import 'package:SEFER/constant/box_name.dart'; @@ -8,7 +6,6 @@ import 'package:SEFER/constant/style.dart'; import 'package:SEFER/controller/functions/crud.dart'; import 'package:SEFER/controller/home/map_passenger_controller.dart'; import 'package:SEFER/main.dart'; -import 'package:SEFER/views/home/Captin/home_captain/home_captin.dart'; import 'package:SEFER/views/home/map_page_passenger.dart'; import 'package:SEFER/views/widgets/elevated_btn.dart'; @@ -37,42 +34,42 @@ class RateController extends GetxController { update(); } - void addRateToPassenger() async { - // HomeCaptainController homeCaptainController = - // Get.find(); - // Get.put(MapDriverController()); - if (selectedRateItemId < 1) { - Get.defaultDialog( - title: 'You Should choose rate figure'.tr, - titleStyle: AppStyle.title, - middleText: '', - confirm: MyElevatedButton(title: 'Ok', onPressed: () => Get.back())); - } else { - await CRUD().post(link: AppLink.addRateToPassenger, payload: { - 'passenger_id': passengerId, - 'driverID': box.read(BoxName.driverID).toString(), - 'rideId': rideId, - 'rating': selectedRateItemId.toString(), - 'comment': comment.text, - }); - await CRUD().sendEmail(AppLink.sendEmailToPassengerForTripDetails, { - 'startLocation': - Get.find().passengerLocation.toString(), - 'endLocation': - Get.find().passengerDestination.toString(), - 'name': Get.find().passengerName.toString(), - 'timeOfTrip': Get.find().timeOfOrder.toString(), - 'fee': Get.find().totalPassenger.toString(), - 'duration': Get.find().duration.toString(), - 'phone': Get.find().passengerPhone.toString(), - 'email': Get.find().passengerEmail.toString(), - }); - // homeCaptainController.isActive = true; - // update(); - // homeCaptainController.getPaymentToday(); - Get.offAll(HomeCaptain()); - } - } + // void addRateToPassenger() async { + // // HomeCaptainController homeCaptainController = + // // Get.find(); + // // Get.put(MapDriverController()); + // if (selectedRateItemId < 1) { + // Get.defaultDialog( + // title: 'You Should choose rate figure'.tr, + // titleStyle: AppStyle.title, + // middleText: '', + // confirm: MyElevatedButton(title: 'Ok', onPressed: () => Get.back())); + // } else { + // await CRUD().post(link: AppLink.addRateToPassenger, payload: { + // 'passenger_id': passengerId, + // 'driverID': box.read(BoxName.driverID).toString(), + // 'rideId': rideId, + // 'rating': selectedRateItemId.toString(), + // 'comment': comment.text, + // }); + // await CRUD().sendEmail(AppLink.sendEmailToPassengerForTripDetails, { + // 'startLocation': + // Get.find().passengerLocation.toString(), + // 'endLocation': + // Get.find().passengerDestination.toString(), + // 'name': Get.find().passengerName.toString(), + // 'timeOfTrip': Get.find().timeOfOrder.toString(), + // 'fee': Get.find().totalPassenger.toString(), + // 'duration': Get.find().duration.toString(), + // 'phone': Get.find().passengerPhone.toString(), + // 'email': Get.find().passengerEmail.toString(), + // }); + // // homeCaptainController.isActive = true; + // // update(); + // // homeCaptainController.getPaymentToday(); + // Get.offAll(HomeCaptain()); + // } + // } void addRateToDriver() async { if (selectedRateItemId < 1) { diff --git a/lib/main.dart b/lib/main.dart index d106ba1..4e49f10 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,6 @@ import 'dart:io'; import 'package:SEFER/controller/payment/paymob/paymob_response.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; @@ -18,7 +17,6 @@ import 'constant/info.dart'; import 'controller/firebase/firbase_messge.dart'; import 'controller/firebase/local_notification.dart'; import 'controller/functions/device_info.dart'; -import 'controller/functions/location_background_controller.dart'; import 'controller/local/local_controller.dart'; import 'controller/local/translations.dart'; import 'controller/payment/paymob/paymob_wallet.dart'; @@ -57,16 +55,7 @@ void main() async { print(Get.deviceLocale!.countryCode); Stripe.publishableKey = AK.publishableKey; - if (box.read(BoxName.driverID) != null) { - // Get.defaultDialog( - // title: 'Gps required', - // middleText: '', - // confirm: MyElevatedButton( - // title: 'ok'.tr, - // onPressed: () { - // Get.put(LocationBackgroundController()); - // })); - } + if (box.read(BoxName.driverID) != null) {} if (Platform.isAndroid || Platform.isIOS) { await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, @@ -78,8 +67,6 @@ void main() async { List initializationTasks = [ FirebaseMessagesController().getNotificationSettings(), FirebaseMessagesController().getToken(), - // Get.put(LocationController()).startLocationUpdates(), - // Get.put(LocationBackgroundController()).startBackLocation(), ]; // cameras = await availableCameras(); await Future.wait(initializationTasks); @@ -88,13 +75,6 @@ void main() async { DeviceOrientation.portraitDown, ]); } - // PaymobPayment.instance.initialize( - // apiKey: AK - // .payMobApikey, // from dashboard Select Settings -> Account Info -> API Key - // integrationID: int.parse(AK.integrationIdPayMob), - // userTokenExpiration: 200, - // iFrameID: 837992, - // ); PaymobPayment.instance.initialize( apiKey: AK .payMobApikey, // from dashboard Select Settings -> Account Info -> API Key diff --git a/lib/views/Rate/rate_passenger.dart b/lib/views/Rate/rate_passenger.dart deleted file mode 100644 index f96232a..0000000 --- a/lib/views/Rate/rate_passenger.dart +++ /dev/null @@ -1,195 +0,0 @@ -import 'package:SEFER/controller/home/captin/map_driver_controller.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_rating_bar/flutter_rating_bar.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; - -import '../../constant/style.dart'; -import '../../controller/rate/rate_conroller.dart'; - -class RatePassenger extends StatelessWidget { - final RateController controller = Get.put(RateController()); - - RatePassenger({super.key}); - - @override - Widget build(BuildContext context) { - return MyScafolld( - title: 'Rate Passenger'.tr, - body: [ - Positioned( - top: 40, - left: Get.width * .1, - right: Get.width * .1, - child: Container( - decoration: AppStyle.boxDecoration, - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(4), - child: Container( - height: Get.height * .25, - decoration: AppStyle.boxDecoration1, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - '${'Total price from '.tr}${Get.find().passengerName}', - style: AppStyle.title, - ), - Container( - decoration: BoxDecoration( - border: Border.all( - width: 2, - color: AppColor.redColor, - )), - child: Padding( - padding: const EdgeInsets.all(4), - child: Text( - (double.parse(controller.price.toString()) * - .12 + - double.parse( - controller.price.toString())) - .toStringAsFixed(2), - style: AppStyle.number.copyWith( - color: AppColor.redColor, - textBaseline: TextBaseline.ideographic, - decoration: TextDecoration.lineThrough, - decorationColor: AppColor.redColor), - ), - ), - ), - const SizedBox( - height: 10, - ), - Container( - decoration: BoxDecoration( - border: Border.all( - width: 2, - color: AppColor.greenColor, - )), - child: Padding( - padding: const EdgeInsets.all(4), - child: Text( - Get.find().paymentAmount, - style: AppStyle.number, - ), - ), - ), - const SizedBox( - height: 10, - ), - Text( - 'Exclusive offers and discounts always with the Sefer app' - .tr, - textAlign: TextAlign.center, - style: AppStyle.title - .copyWith(color: AppColor.redColor), - ) - ], - )), - ), - Center( - child: RatingBar.builder( - initialRating: 0, - itemCount: 5, - itemSize: 50, - itemPadding: const EdgeInsets.symmetric(horizontal: 2), - itemBuilder: (context, index) { - switch (index) { - case 0: - return const Icon( - Icons.sentiment_very_dissatisfied, - color: Colors.red, - ); - case 1: - return const Icon( - Icons.sentiment_dissatisfied, - color: Colors.redAccent, - ); - case 2: - return const Icon( - Icons.sentiment_neutral, - color: Colors.amber, - ); - case 3: - return const Icon( - Icons.sentiment_satisfied, - color: Colors.lightGreen, - ); - case 4: - return const Icon( - Icons.sentiment_very_satisfied, - color: Colors.green, - ); - default: - return const Icon( - Icons.sentiment_neutral, - color: Colors.amber, - ); - } // - }, - onRatingUpdate: (rating) { - controller.selectRateItem(rating); - }, - ), - ), - const SizedBox( - height: 20, - ), - SizedBox( - width: Get.width * .75, - child: TextFormField( - maxLines: 4, - minLines: 1, - keyboardType: TextInputType.multiline, - controller: controller.comment, - decoration: InputDecoration( - labelText: 'Enter your Note'.tr, - hintText: 'Type something...', - prefixIcon: const Icon( - Icons.rate_review), // Add an icon as a prefix - suffixIcon: IconButton( - icon: const Icon( - Icons.clear, - color: AppColor.redColor, - ), // Add an icon as a suffix - onPressed: () { - controller.comment.clear(); - }, - ), - border: - const OutlineInputBorder(), // Add a border around the input field - enabledBorder: const OutlineInputBorder( - borderSide: BorderSide( - color: Colors.blue), // Customize the border color - ), - focusedBorder: const OutlineInputBorder( - borderSide: BorderSide( - color: Colors - .green), // Customize the border color when focused - ), - errorBorder: const OutlineInputBorder( - borderSide: BorderSide( - color: Colors - .red), // Customize the border color when there's an error - ), - ), - ), - ), - const SizedBox( - height: 20, - ), - MyElevatedButton( - title: 'Submit rating'.tr, - onPressed: () => controller.addRateToPassenger()) - ], - ), - )), - ], - isleading: false, - ); - } -} diff --git a/lib/views/Rate/ride_calculate_driver.dart b/lib/views/Rate/ride_calculate_driver.dart deleted file mode 100644 index 72c1712..0000000 --- a/lib/views/Rate/ride_calculate_driver.dart +++ /dev/null @@ -1,212 +0,0 @@ -import 'package:fl_chart/fl_chart.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/info.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; -import 'package:SEFER/views/widgets/mycircular.dart'; -import 'package:flutter/animation.dart'; -import '../../controller/home/captin/duration_controller .dart'; - -class RideCalculateDriver extends StatelessWidget { - RideCalculateDriver({super.key}); - // DurationController durationController = Get.put(DurationController()); - - @override - Widget build(BuildContext context) { - Get.put(DurationController()); - return MyScafolld( - title: 'Ride Summaries'.tr, - body: [ - Center( - child: GetBuilder( - builder: (durationController) => durationController.isLoading - ? const Center(child: MyCircularProgressIndicator()) - : Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - '${'Average of Hours of'.tr} ${AppInformation.appName}${' is ON for this month'.tr}${' ${durationController.jsonData1['message'][0]['day'].toString().split('-')[1]}'.tr}', - style: AppStyle.title, - textAlign: TextAlign.center, - ), - SizedBox( - height: Get.height * .4, - child: LineChart( - duration: const Duration(milliseconds: 150), - curve: Curves.ease, - LineChartData( - lineBarsData: [ - LineChartBarData( - spots: durationController.chartData, - isCurved: true, - color: Colors.deepPurpleAccent, // Custom color - barWidth: 3, // Thinner line - dotData: const FlDotData( - show: true), // Show dots on each point - belowBarData: BarAreaData( - // Add gradient fill below the line - show: true, - color: AppColor.deepPurpleAccent, - ), - isStrokeJoinRound: true, - shadow: const BoxShadow( - color: AppColor.yellowColor, - blurRadius: 4, - offset: Offset(2, 2), - ), - ), - ], - showingTooltipIndicators: const [], - titlesData: FlTitlesData( - show: true, - topTitles: AxisTitles( - axisNameWidget: Text( - 'Days'.tr, - style: AppStyle.title, - ), - axisNameSize: 30, - sideTitles: const SideTitles( - reservedSize: 30, showTitles: true)), - bottomTitles: AxisTitles( - axisNameWidget: Text( - 'Total Hours on month'.tr, - style: AppStyle.title, - ), - axisNameSize: 30, - sideTitles: const SideTitles( - reservedSize: 30, showTitles: true)), - leftTitles: AxisTitles( - axisNameWidget: Text( - 'Counts of Hours on days'.tr, - style: AppStyle.title, - ), - axisNameSize: 30, - sideTitles: const SideTitles( - reservedSize: 30, showTitles: true)), - ), - gridData: const FlGridData( - show: true, - ), - borderData: FlBorderData( - show: true, - border: const Border( - bottom: BorderSide(color: AppColor.accentColor), - left: BorderSide(color: AppColor.accentColor), - ), - ), - ), - ), - ), - ], - ), - ) - // BarChartWidget(), - ), - ], - isleading: true); - } -} - -// class BarChartWidget extends StatelessWidget { -// const BarChartWidget({super.key}); - -// @override -// Widget build(BuildContext context) { -// final durationController = Get.put(DurationController()); -// return Obx(() { -// final data = durationController.data; -// double maxDuration = 0; - -// // Find the maximum duration to determine the maximum height of the bars -// for (final entry in data) { -// final durationInHours = entry.totalDuration.inHours.toDouble(); -// if (durationInHours > maxDuration) { -// maxDuration = durationInHours; -// } -// } - -// return durationController.isLoading -// ? const Center( -// child: MyCircularProgressIndicator(), -// ) -// : Column( -// children: [ -// Text( -// 'Average of Hours of ${AppInformation.appName} is ON for this month' -// .tr, -// style: AppStyle.title, -// ), -// Padding( -// padding: const EdgeInsets.all(8.0), -// child: Container( -// height: Get.height * .7, -// decoration: AppStyle.boxDecoration, -// child: ListView.builder( -// scrollDirection: Axis.horizontal, -// itemCount: data.length, -// itemBuilder: (context, index) { -// final entry = data[index]; -// final durationInHours = -// entry.totalDuration.inHours.toDouble(); -// final dayLabel = entry.day.day.toString(); - -// return Padding( -// padding: const EdgeInsets.symmetric(horizontal: 4), -// child: AnimatedBuilder( -// // animation: durationController.animationController, -// builder: (context, child) { -// final animationValue = -// durationController.animationController.value; -// final animatedValue = -// (durationInHours / maxDuration) * -// animationValue; - -// return Column( -// mainAxisAlignment: MainAxisAlignment.end, -// children: [ -// Transform( -// transform: Matrix4.identity() -// ..setEntry(3, 2, -// 0.001) // Apply perspective for a 3D effect -// ..rotateX(-0.5 * -// animatedValue), // Rotate around X-axis -// alignment: Alignment.bottomCenter, -// child: Container( -// width: 20, -// height: -// (durationInHours / maxDuration) * 400, -// color: durationInHours > 8 -// ? AppColor.greenColor -// : AppColor.yellowColor, -// child: Center( -// child: Text( -// durationInHours.toStringAsFixed( -// 0, -// ), // Display the duration value inside the bar -// style: const TextStyle( -// color: Colors.white, -// fontWeight: FontWeight.bold, -// ), -// ), -// ), -// ), -// ), -// const SizedBox(height: 4), -// Text(dayLabel), -// ], -// ); -// }, -// ), -// ); -// }, -// ), -// ), -// ), -// ], -// ); -// }); -// } -// } diff --git a/lib/views/admin/admin_home_page.dart b/lib/views/admin/admin_home_page.dart deleted file mode 100644 index b6f17c0..0000000 --- a/lib/views/admin/admin_home_page.dart +++ /dev/null @@ -1,111 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:get/get_rx/src/rx_typedefs/rx_typedefs.dart'; -import 'package:SEFER/constant/box_name.dart'; -import 'package:SEFER/constant/links.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/controller/functions/crud.dart'; -import 'package:SEFER/main.dart'; -import 'package:SEFER/views/admin/rides/rides.dart'; -import 'package:SEFER/views/admin/static/static.dart'; -import 'package:SEFER/views/admin/wallet/wallet.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; - -import '../../controller/auth/captin/ml_google_doc.dart'; -import '../../controller/functions/device_info.dart'; -import '../../controller/functions/gemeni.dart'; -import 'captain/captain.dart'; -import 'passenger/passenger.dart'; - -class AdminHomePage extends StatelessWidget { - const AdminHomePage({super.key}); - - @override - Widget build(BuildContext context) { - return MyScafolld( - title: 'Admin Home Page', - body: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.center, - alignment: WrapAlignment.center, - children: [ - AdminWidgetsDashBoard( - title: 'Passengers', - onPressed: () => Get.to(() => Passengrs(), - transition: Transition.topLevel)), - AdminWidgetsDashBoard( - title: 'Captains', - onPressed: () => - Get.to(() => Captain(), transition: Transition.size)), - AdminWidgetsDashBoard( - title: 'Wallet', - onPressed: () => - Get.to(() => Wallet(), transition: Transition.fade)), - AdminWidgetsDashBoard( - title: 'Rides', - onPressed: () => - Get.to(() => Rides(), transition: Transition.downToUp)), - AdminWidgetsDashBoard( - title: 'Static', - onPressed: () => Get.to(() => StaticDash())), - AdminWidgetsDashBoard( - title: 'Gemeni', onPressed: () => AI().generateContent()), - AdminWidgetsDashBoard( - title: 'CarLicenseJordan', - onPressed: () => AI().carLicenseJordan()), - AdminWidgetsDashBoard( - title: 'JordanID', onPressed: () => AI().jordanID()), - AdminWidgetsDashBoard( - title: 'Llama', - onPressed: () => - CarRegistrationRecognizerController().scanText()), - AdminWidgetsDashBoard( - title: 'Add device to be Admin', - onPressed: () async { - // Map device = DeviceInfoPlus.deviceData; - // print(device); - await CRUD().post(link: AppLink.addAdminUser, payload: { - // 'deviceNumber': device['serialNumber'].toString(), - 'name': 'b', - }); - }), - ], - ), - ) - ], - isleading: false); - } -} - -class AdminWidgetsDashBoard extends StatelessWidget { - const AdminWidgetsDashBoard({ - super.key, - required this.title, - required this.onPressed, - }); - final String title; - final Callback onPressed; - - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.all(8.0), - child: InkWell( - onTap: onPressed, - child: Container( - decoration: AppStyle.boxDecoration, - height: 100, - width: Get.width * .4, - child: Center( - child: Text( - title.tr, - style: AppStyle.title, - ), - ), - ), - ), - ); - } -} diff --git a/lib/views/admin/captain/captain.dart b/lib/views/admin/captain/captain.dart deleted file mode 100644 index 0aab1d8..0000000 --- a/lib/views/admin/captain/captain.dart +++ /dev/null @@ -1,223 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/views/admin/captain/captain_details.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; - -import '../../../constant/colors.dart'; -import '../../../constant/style.dart'; -import '../../../controller/admin/captain_admin_controller.dart'; -import '../../widgets/elevated_btn.dart'; -import '../../widgets/my_textField.dart'; -import '../../widgets/mycircular.dart'; -import 'form_captain.dart'; - -class Captain extends StatelessWidget { - Captain({super.key}); - final CaptainAdminController captainAdminController = - Get.put(CaptainAdminController()); - @override - Widget build(BuildContext context) { - return MyScafolld( - title: 'Captain'.tr, - body: [ - GetBuilder( - builder: (captainAdminController) => Column( - children: [ - captainAdminController.isLoading - ? const MyCircularProgressIndicator() - : Column( - children: [ - Padding( - padding: const EdgeInsets.all(5), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - captainAdmin( - captainAdminController, - 'Captains Count', - 'countPassenger', - ), - MyElevatedButton( - title: 'Add Prize to Gold Captains', - onPressed: () { - var date = DateTime.now(); - var day = date.weekday; - - if (day == 6) { - // Saturday is 6 - // print(day); - Get.defaultDialog( - title: - 'Add Prize to Gold Captains', - titleStyle: AppStyle.title, - content: Column( - children: [ - Text( - 'Add Points to their wallet as prize' - .tr, - style: AppStyle.title, - ), - Form( - key: captainAdminController - .formCaptainPrizeKey, - child: MyTextForm( - controller: - captainAdminController - .captainPrizeController, - label: - 'Count of prize' - .tr, - hint: 'Count of prize' - .tr, - type: TextInputType - .number)) - ], - ), - confirm: MyElevatedButton( - title: 'Add', - onPressed: () async { - if (captainAdminController - .formCaptainPrizeKey - .currentState! - .validate()) { - captainAdminController - .addCaptainsPrizeToWalletSecure(); - } - }, - ), - ); - } else { - Get.defaultDialog( - title: - 'This day is not allowed', - titleStyle: AppStyle.title, - middleText: - 'Saturday only Allowed day', - middleTextStyle: AppStyle.title, - confirm: MyElevatedButton( - title: 'Ok'.tr, - onPressed: () { - Get.back(); - })); - } - }) - ], - ), - ), - const SizedBox( - height: 10, - ), - InkWell( - onTap: () { - //todo search - }, - child: Padding( - padding: const EdgeInsets.all(3), - child: Container( - width: Get.width, - height: 110, - decoration: BoxDecoration( - border: Border.all( - width: 2, - color: AppColor.greenColor)), - child: formSearchCaptain() - // ], - // ), - ), - ), - ), - SizedBox( - height: Get.height * .5, - child: ListView.builder( - itemCount: captainAdminController - .captainData['message'].length, - itemBuilder: (context, index) { - final user = captainAdminController - .captainData['message'][index]; - - return InkWell( - onTap: () { - Get.to(const CaptainsDetailsPage(), - arguments: { - 'data': user, - }); - }, - child: Padding( - padding: const EdgeInsets.all(3), - child: Container( - decoration: BoxDecoration( - border: Border.all(width: 2)), - child: ListTile( - title: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - Text( - 'Name : ${user['first_name']} ${user['last_name']}', - style: AppStyle.title, - ), - Text( - 'Rating : ${user['ratingPassenger']}', - style: AppStyle.title, - ), - ], - ), - subtitle: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - Text( - 'Count Trip : ${user['countPassengerRide']}', - style: AppStyle.title, - ), - Text( - 'Count Driver Rate : ${user['countDriverRate']}', - style: AppStyle.title, - ), - ], - ), - ), - ), - ), - ); - }, - ), - ), - ], - ), - ], - )) - ], - isleading: true, - ); - } - - Container captainAdmin(CaptainAdminController captainAdminController, - String title, String jsonField) { - return Container( - height: Get.height * .1, - decoration: BoxDecoration(border: Border.all(width: 2)), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: GestureDetector( - onTap: () {}, - child: Column( - children: [ - Text( - title.tr, - style: AppStyle.title, - ), - Text( - captainAdminController.captainData['message'][0][jsonField] - .toString(), - style: AppStyle.title, - ), - ], - ), - ), - ), - ); - } -} diff --git a/lib/views/admin/captain/captain_details.dart b/lib/views/admin/captain/captain_details.dart deleted file mode 100644 index 4f99ff1..0000000 --- a/lib/views/admin/captain/captain_details.dart +++ /dev/null @@ -1,168 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/controller/firebase/firbase_messge.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; -import 'package:SEFER/views/widgets/my_textField.dart'; - -import '../../../controller/admin/captain_admin_controller.dart'; - -class CaptainsDetailsPage extends StatelessWidget { - const CaptainsDetailsPage({super.key}); - - @override - Widget build(BuildContext context) { - final arguments = Get.arguments; - final Map data = arguments['data']; - var key = Get.find().formCaptainPrizeKey; - var titleNotify = Get.find().titleNotify; - var bodyNotify = Get.find().bodyNotify; - return MyScafolld( - title: data['first_name'] + ' ' + data['last_name'], - body: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Email is ${data['email']}', - style: AppStyle.title, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Phone is ${data['phone']}', - style: AppStyle.title, - ), - Text( - 'gender is ${data['gender']}', - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'status is ${data['status']}', - style: AppStyle.title, - ), - Text( - 'birthdate is ${data['birthdate']}', - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'site is ${data['site']}', - style: AppStyle.title, - ), - // Text( - // 'sosPhone is ${data['sosPhone']}', - // style: AppStyle.title, - // ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Count Feedback is ${data['countFeedback']}', - style: AppStyle.title, - ), - Text( - 'Count Driver Rate is ${data['countDriverRate']}', - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Count Cancel is ${data['countPassengerCancel']}', - style: AppStyle.title, - ), - Text( - 'Count Ride is ${data['countPassengerRide']}', - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Rating Captain Avarage is ${data['passengerAverageRating']}', - style: AppStyle.title, - ), - Text( - 'Rating is ${data['ratingPassenger']}', - style: AppStyle.title, - ), - ], - ), - Container( - decoration: BoxDecoration( - border: Border.all(width: 3, color: AppColor.yellowColor)), - child: TextButton( - onPressed: () async { - Get.defaultDialog( - title: 'Send Notification'.tr, - titleStyle: AppStyle.title, - content: Form( - key: key, - child: Column( - children: [ - MyTextForm( - controller: titleNotify, - label: 'title'.tr, - hint: 'title notificaton'.tr, - type: TextInputType.name), - const SizedBox( - height: 10, - ), - MyTextForm( - controller: bodyNotify, - label: 'body'.tr, - hint: 'body notificaton'.tr, - type: TextInputType.name) - ], - ), - ), - confirm: MyElevatedButton( - title: 'Send', - onPressed: () { - print(titleNotify.text); - if (key.currentState!.validate()) { - FirebaseMessagesController() - .sendNotificationToAnyWithoutData( - titleNotify.text, - bodyNotify.text, - data['passengerToken'], - ); - Get.back(); - } - })); - }, - child: Text( - "Send Notificaion to Captains ".tr, - style: AppStyle.title, - ), - ), - ) - ], - ), - ) - ], - isleading: true, - ); - } -} diff --git a/lib/views/admin/captain/form_captain.dart b/lib/views/admin/captain/form_captain.dart deleted file mode 100644 index 5815c97..0000000 --- a/lib/views/admin/captain/form_captain.dart +++ /dev/null @@ -1,86 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/controller/admin/captain_admin_controller.dart'; -import 'package:SEFER/views/admin/captain/captain_details.dart'; -import 'package:SEFER/views/admin/passenger/passenger_details_page.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; - -import '../../../constant/colors.dart'; -import '../../../constant/style.dart'; - -GetBuilder formSearchCaptain() { - // DbSql sql = DbSql.instance; - return GetBuilder( - builder: (controller) => Column( - children: [ - Padding( - padding: const EdgeInsets.all(16), - child: Container( - decoration: - const BoxDecoration(color: AppColor.secondaryColor), - child: TextField( - decoration: InputDecoration( - border: const OutlineInputBorder( - borderRadius: BorderRadius.only(), - gapPadding: 4, - borderSide: BorderSide( - color: AppColor.redColor, - width: 2, - )), - suffixIcon: InkWell( - onTap: () async { - if (controller.captainController.text.length > 4) { - await controller.getCaptains(); - - Get.defaultDialog( - title: controller.captain['message'][0] - ['email'], - titleStyle: AppStyle.title, - content: Column( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Name is ${controller.captain['message'][0]['first_name']} ${controller.captain['message'][0]['last_name']}', - style: AppStyle.title, - ), - Text( - 'phone is ${controller.captain['message'][0]['phone']}', - style: AppStyle.title, - ), - ], - ), - confirm: MyElevatedButton( - title: 'Go To Details'.tr, - onPressed: () { - Get.to( - () => const CaptainsDetailsPage(), - arguments: { - 'data': controller - .captain['message'][0], - }); - })); - } - }, - child: const Icon(Icons.search)), - hintText: 'Search for Passenger'.tr, - hintStyle: AppStyle.title, - hintMaxLines: 1, - prefixIcon: IconButton( - onPressed: () async { - controller.captainController.clear(); - // controller.clearPlaces(); - }, - icon: Icon( - Icons.clear, - color: Colors.red[300], - ), - ), - ), - controller: controller.captainController, - ), - ), - ) - ], - )); -} diff --git a/lib/views/admin/passenger/form_passenger.dart b/lib/views/admin/passenger/form_passenger.dart deleted file mode 100644 index 3546837..0000000 --- a/lib/views/admin/passenger/form_passenger.dart +++ /dev/null @@ -1,86 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/views/admin/passenger/passenger_details_page.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; - -import '../../../constant/colors.dart'; -import '../../../constant/style.dart'; -import '../../../controller/admin/passenger_admin_controller.dart'; - -GetBuilder formSearchPassengers() { - // DbSql sql = DbSql.instance; - return GetBuilder( - builder: (controller) => Column( - children: [ - Padding( - padding: const EdgeInsets.all(16), - child: Container( - decoration: - const BoxDecoration(color: AppColor.secondaryColor), - child: TextField( - decoration: InputDecoration( - border: const OutlineInputBorder( - borderRadius: BorderRadius.only(), - gapPadding: 4, - borderSide: BorderSide( - color: AppColor.redColor, - width: 2, - )), - suffixIcon: InkWell( - onTap: () async { - if (controller.passengerController.text.length > - 4) { - await controller.getPassengers(); - - Get.defaultDialog( - title: controller.passengers['message'][0] - ['email'], - titleStyle: AppStyle.title, - content: Column( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Name is ${controller.passengers['message'][0]['first_name']} ${controller.passengers['message'][0]['last_name']}', - style: AppStyle.title, - ), - Text( - 'phone is ${controller.passengers['message'][0]['phone']}', - style: AppStyle.title, - ), - ], - ), - confirm: MyElevatedButton( - title: 'Go To Details'.tr, - onPressed: () { - Get.to( - () => const PassengerDetailsPage(), - arguments: { - 'data': controller - .passengers['message'][0], - }); - })); - } - }, - child: const Icon(Icons.search)), - hintText: 'Search for Passenger'.tr, - hintStyle: AppStyle.title, - hintMaxLines: 1, - prefixIcon: IconButton( - onPressed: () async { - controller.passengerController.clear(); - controller.clearPlaces(); - }, - icon: Icon( - Icons.clear, - color: Colors.red[300], - ), - ), - ), - controller: controller.passengerController, - ), - ), - ) - ], - )); -} diff --git a/lib/views/admin/passenger/passenger.dart b/lib/views/admin/passenger/passenger.dart deleted file mode 100644 index a3e0366..0000000 --- a/lib/views/admin/passenger/passenger.dart +++ /dev/null @@ -1,206 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/controller/admin/passenger_admin_controller.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; -import 'package:SEFER/views/widgets/my_textField.dart'; -import 'package:SEFER/views/widgets/mycircular.dart'; - -import 'form_passenger.dart'; -import 'passenger_details_page.dart'; - -class Passengrs extends StatelessWidget { - Passengrs({super.key}); - final PassengerAdminController passengerAdminController = - Get.put(PassengerAdminController()); - @override - Widget build(BuildContext context) { - return MyScafolld( - title: 'Passengrs'.tr, - isleading: true, - body: [ - GetBuilder( - builder: (passengerAdminController) => Column( - children: [ - passengerAdminController.isLoading - ? const MyCircularProgressIndicator() - : Column( - children: [ - Padding( - padding: const EdgeInsets.all(5), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - passengerAdmin( - passengerAdminController, - 'Passengers Count', - 'countPassenger', - ), - MyElevatedButton( - title: 'Add Prize to Gold Passengers', - onPressed: () { - var date = DateTime.now(); - var day = date.weekday; - - if (day == 6) { - // Saturday is 6 - print(day); - Get.defaultDialog( - title: - 'Add Prize to Gold Passengers', - titleStyle: AppStyle.title, - content: Column( - children: [ - Text( - 'Add Points to their wallet as prize' - .tr, - style: AppStyle.title, - ), - Form( - key: - passengerAdminController - .formPrizeKey, - child: MyTextForm( - controller: - passengerAdminController - .passengerPrizeController, - label: - 'Count of prize' - .tr, - hint: 'Count of prize' - .tr, - type: TextInputType - .number)) - ], - ), - confirm: MyElevatedButton( - title: 'Add', - onPressed: () async { - if (passengerAdminController - .formPrizeKey - .currentState! - .validate()) { - passengerAdminController - .addPassengerPrizeToWalletSecure(); - } - }, - ), - ); - } else { - Get.defaultDialog( - title: - 'This day is not allowed', - titleStyle: AppStyle.title, - middleText: - 'Saturday only Allowed day', - middleTextStyle: AppStyle.title, - confirm: MyElevatedButton( - title: 'Ok'.tr, - onPressed: () { - Get.back(); - })); - } - }) - ], - ), - ), - const SizedBox( - height: 10, - ), - formSearchPassengers(), - SizedBox( - height: Get.height * .5, - child: ListView.builder( - itemCount: passengerAdminController - .passengersData['message'].length, - itemBuilder: (context, index) { - final user = passengerAdminController - .passengersData['message'][index]; - - return InkWell( - onTap: () { - Get.to(const PassengerDetailsPage(), - arguments: { - 'data': user, - }); - }, - child: Padding( - padding: const EdgeInsets.all(3), - child: Container( - decoration: BoxDecoration( - border: Border.all(width: 2)), - child: ListTile( - title: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - Text( - 'Name : ${user['first_name']} ${user['last_name']}', - style: AppStyle.title, - ), - Text( - 'Rating : ${user['ratingPassenger']}', - style: AppStyle.title, - ), - ], - ), - subtitle: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - Text( - 'Count Trip : ${user['countPassengerRide']}', - style: AppStyle.title, - ), - Text( - 'Count Driver Rate : ${user['countDriverRate']}', - style: AppStyle.title, - ), - ], - ), - ), - ), - ), - ); - }, - ), - ), - ], - ), - ], - )) - ], - ); - } - - Container passengerAdmin(PassengerAdminController passengerAdminController, - String title, String jsonField) { - return Container( - height: Get.height * .1, - decoration: BoxDecoration(border: Border.all(width: 2)), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: GestureDetector( - onTap: () {}, - child: Column( - children: [ - Text( - title.tr, - style: AppStyle.title, - ), - Text( - passengerAdminController.passengersData['message'][0][jsonField] - .toString(), - style: AppStyle.title, - ), - ], - ), - ), - ), - ); - } -} diff --git a/lib/views/admin/passenger/passenger_details_page.dart b/lib/views/admin/passenger/passenger_details_page.dart deleted file mode 100644 index dc51a07..0000000 --- a/lib/views/admin/passenger/passenger_details_page.dart +++ /dev/null @@ -1,168 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/controller/firebase/firbase_messge.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; -import 'package:SEFER/views/widgets/my_textField.dart'; - -import '../../../controller/admin/passenger_admin_controller.dart'; - -class PassengerDetailsPage extends StatelessWidget { - const PassengerDetailsPage({super.key}); - - @override - Widget build(BuildContext context) { - final arguments = Get.arguments; - final Map data = arguments['data']; - var key = Get.find().formPrizeKey; - var titleNotify = Get.find().titleNotify; - var bodyNotify = Get.find().bodyNotify; - return MyScafolld( - title: data['first_name'], - body: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Email is ${data['email']}', - style: AppStyle.title, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Phone is ${data['phone']}', - style: AppStyle.title, - ), - Text( - 'gender is ${data['gender']}', - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'status is ${data['status']}', - style: AppStyle.title, - ), - Text( - 'birthdate is ${data['birthdate']}', - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'site is ${data['site']}', - style: AppStyle.title, - ), - Text( - 'sosPhone is ${data['sosPhone']}', - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Count Feedback is ${data['countFeedback']}', - style: AppStyle.title, - ), - Text( - 'Count Driver Rate is ${data['countDriverRate']}', - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Count Cancel is ${data['countPassengerCancel']}', - style: AppStyle.title, - ), - Text( - 'Count Ride is ${data['countPassengerRide']}', - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Rating Captain Avarage is ${data['passengerAverageRating']}', - style: AppStyle.title, - ), - Text( - 'Rating is ${data['ratingPassenger']}', - style: AppStyle.title, - ), - ], - ), - Container( - decoration: BoxDecoration( - border: Border.all(width: 3, color: AppColor.yellowColor)), - child: TextButton( - onPressed: () async { - Get.defaultDialog( - title: 'Send Notification'.tr, - titleStyle: AppStyle.title, - content: Form( - key: key, - child: Column( - children: [ - MyTextForm( - controller: titleNotify, - label: 'title'.tr, - hint: 'title notificaton'.tr, - type: TextInputType.name), - const SizedBox( - height: 10, - ), - MyTextForm( - controller: bodyNotify, - label: 'body'.tr, - hint: 'body notificaton'.tr, - type: TextInputType.name) - ], - ), - ), - confirm: MyElevatedButton( - title: 'Send', - onPressed: () { - print(titleNotify.text); - if (key.currentState!.validate()) { - FirebaseMessagesController() - .sendNotificationToAnyWithoutData( - titleNotify.text, - bodyNotify.text, - data['passengerToken'], - ); - Get.back(); - } - })); - }, - child: Text( - "Send Notificaion to Passenger ".tr, - style: AppStyle.title, - ), - ), - ) - ], - ), - ) - ], - isleading: true, - ); - } -} diff --git a/lib/views/admin/rides/rides.dart b/lib/views/admin/rides/rides.dart deleted file mode 100644 index ad57ae7..0000000 --- a/lib/views/admin/rides/rides.dart +++ /dev/null @@ -1,237 +0,0 @@ -import 'package:fl_chart/fl_chart.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; -import 'package:SEFER/views/widgets/mycircular.dart'; - -import '../../../controller/admin/ride_admin_controller.dart'; - -class Rides extends StatelessWidget { - Rides({super.key}); - RideAdminController rideAdminController = Get.put(RideAdminController()); - @override - Widget build(BuildContext context) { - return MyScafolld(title: 'Rides'.tr, isleading: true, body: [ - GetBuilder( - builder: (rideAdminController) => rideAdminController.isLoading - ? const Center(child: MyCircularProgressIndicator()) - : Column( - children: [ - SizedBox( - height: Get.height * .4, - child: LineChart( - duration: const Duration(milliseconds: 150), - curve: Curves.ease, - LineChartData( - lineBarsData: [ - LineChartBarData( - spots: rideAdminController.chartData, - isCurved: true, - color: Colors.deepPurpleAccent, // Custom color - barWidth: 3, // Thinner line - dotData: const FlDotData( - show: true), // Show dots on each point - belowBarData: BarAreaData( - // Add gradient fill below the line - show: true, - color: AppColor.deepPurpleAccent, - ), - isStrokeJoinRound: true, - shadow: const BoxShadow( - color: AppColor.yellowColor, - blurRadius: 4, - offset: Offset(2, 2), - ), - ), - ], - showingTooltipIndicators: const [], - titlesData: FlTitlesData( - show: true, - topTitles: AxisTitles( - axisNameWidget: Text( - 'Days', - style: AppStyle.title, - ), - axisNameSize: 30, - sideTitles: const SideTitles( - reservedSize: 30, showTitles: true)), - bottomTitles: AxisTitles( - axisNameWidget: Text( - 'Total Trips on month'.tr, - style: AppStyle.title, - ), - axisNameSize: 30, - sideTitles: const SideTitles( - reservedSize: 30, showTitles: true)), - leftTitles: AxisTitles( - axisNameWidget: Text( - 'Counts of Trips on month'.tr, - style: AppStyle.title, - ), - axisNameSize: 30, - sideTitles: const SideTitles( - reservedSize: 30, showTitles: true)), - ), - gridData: const FlGridData( - show: true, - ), - borderData: FlBorderData( - show: true, - border: const Border( - bottom: BorderSide(color: AppColor.accentColor), - left: BorderSide(color: AppColor.accentColor), - ), - ), - ), - ), - ), - // SizedBox( - // height: Get.height * .4, - // child: PieChart( - // PieChartData( - // sectionsSpace: 4, // Adjust spacing between sections - // centerSpaceRadius: - // 40, // Adjust radius of center space - // sections: [ - // for (final rideData in rideAdminController.rideData) - // PieChartSectionData( - // value: rideData.ridesCount.toDouble(), - // title: '${rideData.day}', showTitle: true, - // titleStyle: - // AppStyle.subtitle, // Display day as title - // radius: 60, // Adjust radius of each section - // color: - // AppColor.deepPurpleAccent, // Custom color - // ), - // ], - // ), - // ), - // ), - - // SizedBox( - // // height: 400, - // child: SfCartesianChart( - // legend: const Legend( - // isVisible: true, - // position: LegendPosition.bottom, - // overflowMode: LegendItemOverflowMode.wrap, - // textStyle: TextStyle( - // color: Colors.white, - // fontSize: 12, - // fontWeight: FontWeight.bold, - // ), - // ), - // borderWidth: 2, - // borderColor: AppColor.blueColor, - // plotAreaBorderColor: AppColor.deepPurpleAccent, - // enableAxisAnimation: true, - // primaryXAxis: CategoryAxis( - // borderColor: AppColor.accentColor, borderWidth: 2, - // title: AxisTitle( - // text: 'Total Trips on month'.tr, - // textStyle: AppStyle.title, - // ), - // // labelRotation: 45, - // majorGridLines: const MajorGridLines(width: 0), - // ), - // primaryYAxis: const NumericAxis(isVisible: false), - // series: >[ - // LineSeries( - // dataSource: rideAdminController.chartDatasync, - // xValueMapper: (ChartDataS data, _) => '${data.day}', - // yValueMapper: (ChartDataS data, _) => - // data.ridesCount, - // dataLabelSettings: - // const DataLabelSettings(isVisible: true), - // ), - // ], - // ), - // ), - - const SizedBox( - height: 20, - ), - Card( - elevation: 4, - color: AppColor.deepPurpleAccent, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - 'Total Trips on this Month is ${rideAdminController.jsonResponse['message'][0]['current_month_rides_count']}', - style: AppStyle.title, - ), - ), - ), - const SizedBox( - height: 20, - ), - Card( - elevation: 4, - color: AppColor.yellowColor, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - Text( - 'Driver Average Duration: ${rideAdminController.ridesDetails[0]['driver_avg_duration']}', - style: AppStyle.subtitle, - ), - Text( - 'Number of Drivers: ${rideAdminController.ridesDetails[0]['num_Driver']}', - style: AppStyle.subtitle, - ), - Text( - 'Total Rides: ${rideAdminController.ridesDetails[0]['total_rides']}', - style: AppStyle.subtitle, - ), - Text( - 'Ongoing Rides: ${rideAdminController.ridesDetails[0]['ongoing_rides']}', - style: AppStyle.subtitle, - ), - Text( - 'Completed Rides: ${rideAdminController.ridesDetails[0]['completed_rides']}', - style: AppStyle.subtitle, - ), - Text( - 'Cancelled Rides: ${rideAdminController.ridesDetails[0]['cancelled_rides']}', - style: AppStyle.subtitle, - ), - Text( - 'Longest Duration: ${rideAdminController.ridesDetails[0]['longest_duration']}', - style: AppStyle.subtitle, - ), - Text( - 'Total Distance: ${rideAdminController.ridesDetails[0]['total_distance']} km', - style: AppStyle.subtitle, - ), - Text( - 'Average Distance: ${rideAdminController.ridesDetails[0]['average_distance']} km', - style: AppStyle.subtitle, - ), - Text( - 'Longest Distance: ${rideAdminController.ridesDetails[0]['longest_distance']} km', - style: AppStyle.subtitle, - ), - Text( - 'Total Driver Earnings: \$${rideAdminController.ridesDetails[0]['total_driver_earnings']}', - style: AppStyle.subtitle, - ), - Text( - 'Total Company Earnings: \$${rideAdminController.ridesDetails[0]['total_company_earnings']}', - style: AppStyle.subtitle, - ), - Text( - 'Company Percentage: ${rideAdminController.ridesDetails[0]['companyPercent']} %', - style: AppStyle.subtitle, - ), - ], - ), - ), - ) - ], - )) - ]); - } -} diff --git a/lib/views/admin/static/static.dart b/lib/views/admin/static/static.dart deleted file mode 100644 index 72149b7..0000000 --- a/lib/views/admin/static/static.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; - -class StaticDash extends StatelessWidget { - const StaticDash({super.key}); - - @override - Widget build(BuildContext context) { - return MyScafolld(title: 'Static Dash'.tr, body: [], isleading: true); - } -} diff --git a/lib/views/admin/wallet/wallet.dart b/lib/views/admin/wallet/wallet.dart deleted file mode 100644 index bec2e54..0000000 --- a/lib/views/admin/wallet/wallet.dart +++ /dev/null @@ -1,15 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; - -import '../../../controller/admin/wallet_admin_controller.dart'; - -class Wallet extends StatelessWidget { - Wallet({super.key}); - WalletAdminController walletAdminController = - Get.put(WalletAdminController()); - @override - Widget build(BuildContext context) { - return MyScafolld(title: 'Wallet'.tr, body: [], isleading: true); - } -} diff --git a/lib/views/auth/captin/ai_page.dart b/lib/views/auth/captin/ai_page.dart deleted file mode 100644 index 6aaba72..0000000 --- a/lib/views/auth/captin/ai_page.dart +++ /dev/null @@ -1,979 +0,0 @@ -import 'package:SEFER/constant/box_name.dart'; -import 'package:SEFER/controller/functions/crud.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/constant/table_names.dart'; -import 'package:SEFER/controller/auth/captin/register_captin_controller.dart'; -import 'package:SEFER/controller/functions/ocr_controller.dart'; -import 'package:SEFER/main.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; -import 'package:SEFER/views/widgets/mycircular.dart'; - -import '../../../constant/links.dart'; -import '../../../controller/functions/gemeni.dart'; - -class AiPage extends StatelessWidget { - ScanDocumentsByApi scanDocumentsByApi = Get.put(ScanDocumentsByApi()); - RegisterCaptainController registerCaptainController = - Get.put(RegisterCaptainController()); - AI contentController = Get.put(AI()); - @override - Widget build(BuildContext context) { - return MyScafolld( - title: 'Documents check'.tr, - body: [ - // box.read(BoxName.countryCode) == 'USA' - // ? UsaAiDocuments(scanDocumentsByApi: scanDocumentsByApi) - // : box.read(BoxName.countryCode) == 'Jordan' - // ? JordanDocumants(contentController: contentController) - // : - // EgyptDocuments(contentController: contentController), - // box.read(BoxName.countryCode) == 'USA' - // ? usaDriverLicensWidget() - // : box.read(BoxName.countryCode) == 'Jordan' - // ? jordanDriverLicenseWidget() - // : - egyptDriverLicenseWidget() - ], - isleading: true); - } - - GetBuilder egyptDriverLicenseWidget() { - return GetBuilder( - builder: (contentController) => contentController.responseMap.isNotEmpty - ? Positioned( - top: Get.height * .09, - left: Get.width * .051, - right: Get.width * .051, - child: contentController.isloading - ? Column( - children: [ - const MyCircularProgressIndicator(), - Text( - 'We are process picture please wait '.tr, - style: AppStyle.title, - ) - ], - ) - : SizedBox( - height: Get.height * .7, - child: ListView( - children: [ - Container( - decoration: AppStyle.boxDecoration1, - // height: Get.height * .4, - child: Padding( - padding: const EdgeInsets.all(5), - child: contentController.responseMap.isEmpty - ? Center( - child: Text( - 'Take Picture Of ID Card'.tr, - style: AppStyle.title, - ), - ) - : Column( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - '${'Name'.tr} :${contentController.responseMap['first_name']}', - style: AppStyle.subtitle, - ), - Text( - ' ${contentController.responseMap['last_name']}', - style: AppStyle.subtitle, - ), - ], - ), - Text( - '${'Name in arabic'.tr}: ${contentController.responseMap['name_in_arabic']}', - style: AppStyle.title, - ), - Text( - '${'Drivers License Class'.tr}: ${contentController.responseMap['class']}', - style: AppStyle.title, - ), - ], - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '${'National Number'.tr}: ${contentController.responseMap['id']}', - style: AppStyle.title, - ), - // Image.memory( - // scanDocumentsByApi - // .imagePortrait, - // width: 60, - // ), - ]), - Text( - '${'Address'.tr}: ${contentController.responseMap['address']}', - style: AppStyle.title, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '${'Date of Birth'.tr}: ${contentController.responseMap['dob']}', - style: AppStyle.title, - ), - Text( - '${'Age'.tr} : ${contentController.responseMap['age_in_years']}', - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '${'Expiry Date'.tr}: ${contentController.responseMap['expiration_date']}', - style: DateTime.parse( - contentController - .responseMap[ - 'expiration_date'] - .toString()) - .isBefore( - contentController.now) - ? AppStyle.title.copyWith( - color: AppColor.redColor) - : AppStyle.title.copyWith( - color: - AppColor.greenColor), - ), - ], - ), - ], - ), - ), - ), - const SizedBox( - height: 10, - ), - DateTime.parse(contentController - .responseMap['expiration_date'] - .toString()) - .isBefore(contentController.now) - ? Text( - 'You can\'t continue with us .\nYou should renew Driver license' - .tr, - style: AppStyle.title - .copyWith(color: AppColor.redColor), - ) - : MyElevatedButton( - kolor: AppColor.greenColor, - title: 'Lets check Car license '.tr, - onPressed: () => contentController - .getCarLicenseJordanContent()), - const SizedBox( - height: 10, - ), - contentController.responseCarLicenseMap.isNotEmpty - ? Container( - decoration: AppStyle.boxDecoration, - // height: Get.height * .3, - width: Get.width * .9, - child: Column( - children: [ - Text( - '${'Name'.tr} ${contentController.responseCarLicenseMap['name']}', - style: AppStyle.title, - ), - Text( - '${'Address'.tr} ${contentController.responseCarLicenseMap['address']}', - style: AppStyle.title, - ), - Text( - '${'Car Kind'.tr} ${contentController.responseCarLicenseMap['car_kind']}', - style: AppStyle.title, - ), - Text( - '${'Color'.tr} ${contentController.responseCarLicenseMap['car_color']}', - style: AppStyle.title, - ), - Text( - '${'Year'.tr} ${contentController.responseCarLicenseMap['car_year']}', - style: AppStyle.title, - ), - Text( - '${'Car Plate'.tr} ${contentController.responseCarLicenseMap['car_plate']}', - style: AppStyle.title, - ), - Text( - '${'Car Expire'.tr} ${contentController.responseCarLicenseMap['expire_date_of_license']}', - style: contentController - .responseCarLicenseMap - .isNotEmpty - ? DateTime.parse(contentController - .responseCarLicenseMap[ - 'expire_date_of_license'] - .toString()) - .isBefore( - contentController.now) - ? AppStyle.title.copyWith( - color: AppColor.redColor) - : AppStyle.title.copyWith( - color: AppColor.greenColor) - : null, - ), - ], - ), - ) - : const SizedBox(), - const SizedBox( - height: 10, - ), - // DateTime.parse(contentController - // .responseCarLicenseMap[ - // 'expire_date_of_license'] - // .toString()) - // .isBefore(contentController.now) - // ? Text( - // 'You can\'t continue with us .\nYou should renew Car license' - // .tr, - // style: AppStyle.title.copyWith( - // color: AppColor.redColor), - // ) - // : - MyElevatedButton( - kolor: AppColor.greenColor, - title: 'Lets check License Back Face'.tr, - onPressed: () => contentController - .generateBackCarLicenseJordanContent()), - const SizedBox( - height: 10, - ), - contentController.responseBackCarLicenseMap.isNotEmpty - ? Container( - decoration: AppStyle.boxDecoration, - // height: 300, - child: Column(children: [ - Text( - 'VIN ${contentController.responseBackCarLicenseMap['vin']}', - style: AppStyle.title, - ), - Text( - 'Fuel Type ${contentController.responseBackCarLicenseMap['fuelType']}', - style: AppStyle.title, - ), - Text( - 'Insurance Company ${contentController.responseBackCarLicenseMap['insuranceCompany']}', - style: AppStyle.title, - ), - Text( - 'Policy Number ${contentController.responseBackCarLicenseMap['policyNumber']}', - style: AppStyle.title, - ), - Text( - 'Insurance Type ${contentController.responseBackCarLicenseMap['insuranceType']}', - style: AppStyle.title, - ) - ])) - : const SizedBox() - ], - ), - ), - ) - : Positioned( - top: Get.height * .06, - left: Get.width * .051, - right: Get.width * .051, - child: scanDocumentsByApi.isLoading - ? Column( - children: [ - const MyCircularProgressIndicator(), - Text( - 'We are process picture please wait '.tr, - style: AppStyle.title, - ) - ], - ) - : Column( - children: [ - Container( - decoration: AppStyle.boxDecoration1, - height: Get.height * .35, - child: Padding( - padding: const EdgeInsets.all(5), - child: Center( - child: InkWell( - onTap: () async { - await CRUD().allMethodForAI( - 'name,address,dob,nationalNo,', - AppLink.uploadEgypt, - 'idFront'); //egypt - }, - child: Text( - 'Take Picture Of ID Card'.tr, - style: AppStyle.title, - ), - ), - )), - ), - ], - ), - ), - ); - } - - GetBuilder jordanDriverLicenseWidget() { - return GetBuilder( - builder: (contentController) => contentController.responseMap.isNotEmpty - ? Positioned( - top: Get.height * .09, - left: Get.width * .051, - right: Get.width * .051, - child: contentController.isloading - ? Column( - children: [ - const MyCircularProgressIndicator(), - Text( - 'We are process picture please wait '.tr, - style: AppStyle.title, - ) - ], - ) - : SizedBox( - height: Get.height * .7, - child: ListView( - children: [ - Container( - decoration: AppStyle.boxDecoration, - // height: Get.height * .4, - child: Padding( - padding: const EdgeInsets.all(5), - child: contentController.responseMap.isEmpty - ? Center( - child: Text( - 'There is no data yet.'.tr, - style: AppStyle.title, - ), - ) - : Column( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - '${'Name'.tr} :${contentController.responseMap['first_name']}', - style: AppStyle.subtitle, - ), - Text( - ' ${contentController.responseMap['last_name']}', - style: AppStyle.subtitle, - ), - ], - ), - Text( - '${'Name in arabic'.tr}: ${contentController.responseMap['name_in_arabic']}', - style: AppStyle.title, - ), - Text( - '${'Drivers License Class'.tr}: ${contentController.responseMap['class']}', - style: AppStyle.title, - ), - ], - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '${'National Number'.tr}: ${contentController.responseMap['id']}', - style: AppStyle.title, - ), - // Image.memory( - // scanDocumentsByApi - // .imagePortrait, - // width: 60, - // ), - ]), - Text( - '${'Address'.tr}: ${contentController.responseMap['address']}', - style: AppStyle.title, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '${'Date of Birth'.tr}: ${contentController.responseMap['dob']}', - style: AppStyle.title, - ), - Text( - '${'Age'.tr} : ${contentController.responseMap['age_in_years']}', - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '${'Expiry Date'.tr}: ${contentController.responseMap['expiration_date']}', - style: DateTime.parse( - contentController - .responseMap[ - 'expiration_date'] - .toString()) - .isBefore( - contentController.now) - ? AppStyle.title.copyWith( - color: AppColor.redColor) - : AppStyle.title.copyWith( - color: - AppColor.greenColor), - ), - ], - ), - ], - ), - ), - ), - const SizedBox( - height: 10, - ), - DateTime.parse(contentController - .responseMap['expiration_date'] - .toString()) - .isBefore(contentController.now) - ? Text( - 'You can\'t continue with us .\nYou should renew Driver license' - .tr, - style: AppStyle.title - .copyWith(color: AppColor.redColor), - ) - : MyElevatedButton( - kolor: AppColor.greenColor, - title: 'Lets check Car license '.tr, - onPressed: () => contentController - .getTextFromCard( - '''Extract the following information from the front face of the car license card in Jordan: - -* name -* Address -* Vehicle type -* car_kind -* car_color -* Vehicle category -* car_year -* car_plate -* Registration type -* Usage type -* expire_date_of_license - -Output the extracted information in the following JSON formate and make date format like YYYY-MM-DD''')), - const SizedBox( - height: 10, - ), - contentController.responseCarLicenseMap.isNotEmpty - ? Container( - decoration: AppStyle.boxDecoration, - // height: Get.height * .3, - width: Get.width * .9, - child: Column( - children: [ - Text( - '${'Name'.tr} ${contentController.responseCarLicenseMap['name']}', - style: AppStyle.title, - ), - Text( - '${'Address'.tr} ${contentController.responseCarLicenseMap['address']}', - style: AppStyle.title, - ), - Text( - '${'Car Kind'.tr} ${contentController.responseCarLicenseMap['car_kind']}', - style: AppStyle.title, - ), - Text( - '${'Color'.tr} ${contentController.responseCarLicenseMap['car_color']}', - style: AppStyle.title, - ), - Text( - '${'Year'.tr} ${contentController.responseCarLicenseMap['car_year']}', - style: AppStyle.title, - ), - Text( - '${'Car Plate'.tr} ${contentController.responseCarLicenseMap['car_plate']}', - style: AppStyle.title, - ), - Text( - '${'ُExpire Date'.tr} ${contentController.responseCarLicenseMap['expire_date_of_license']}', - style: contentController - .responseCarLicenseMap - .isNotEmpty - ? DateTime.parse(contentController - .responseCarLicenseMap[ - 'expire_date_of_license'] - .toString()) - .isBefore( - contentController.now) - ? AppStyle.title.copyWith( - color: AppColor.redColor) - : AppStyle.title.copyWith( - color: AppColor.greenColor) - : null, - ), - ], - ), - ) - : const SizedBox(), - const SizedBox( - height: 10, - ), - //todo temporary - // DateTime.parse(contentController - // .responseCarLicenseMap[ - // 'expire_date_of_license'] - // .toString()) - // .isBefore(contentController.now) - // ? Text( - // 'You can\'t continue with us .\nYou should renew Car license' - // .tr, - // style: AppStyle.title.copyWith( - // color: AppColor.redColor), - // ) - // : - MyElevatedButton( - kolor: AppColor.greenColor, - title: 'Lets check License Back Face'.tr, - onPressed: () => - contentController.getTextFromCard( - 'write json output from extracting car license back face for these key ,vin,fuelType,passengerType,curbWeight,insuranceCompany,policyNumber,notes,insuranceType and output it json .dont add data else this image', - )), - const SizedBox( - height: 10, - ), - contentController.responseBackCarLicenseMap.isNotEmpty - ? Container( - decoration: AppStyle.boxDecoration, - // height: 300, - child: Column(children: [ - Text( - 'VIN ${contentController.responseBackCarLicenseMap['vin']}', - style: AppStyle.title, - ), - Text( - 'Fuel Type ${contentController.responseBackCarLicenseMap['fuelType']}', - style: AppStyle.title, - ), - Text( - 'Insurance Company ${contentController.responseBackCarLicenseMap['insuranceCompany']}', - style: AppStyle.title, - ), - Text( - 'Policy Number ${contentController.responseBackCarLicenseMap['policyNumber']}', - style: AppStyle.title, - ), - Text( - 'Insurance Type ${contentController.responseBackCarLicenseMap['insuranceType']}', - style: AppStyle.title, - ) - ])) - : const SizedBox() - // MyElevatedButton( - // title: 'Detect Your Face '.tr, - // onPressed: () => scanDocumentsByApi - // .checkMatchFaceApi(), - // ), - // scanDocumentsByApi.res.isEmpty - // ? const SizedBox() - // : scanDocumentsByApi.res['data'] - // ['result'] - // .toString() == - // 'Same' - // ? MyElevatedButton( - // onPressed: () async { - // await registerCaptainController - // .register(); - // await registerCaptainController - // .addLisence(); - // // await scanDocumentsByApi - // // .uploadImagePortrate(); - // }, - // title: - // 'Go to next step\nscan Car License.' - // .tr, - // kolor: AppColor.greenColor, - // ) - // : const SizedBox(), - // MyElevatedButton( - // title: 'get sql data', - // kolor: AppColor.yellowColor, - // onPressed: () { - // sql.deleteAllData( - // TableName.faceDetectTimes); - // sql - // .getAllData( - // TableName.faceDetectTimes) - // .then((value) => print( - // value[0]['faceDetectTimes'])); - // }, - // ), - ], - ), - ), - ) - : Positioned( - top: Get.height * .06, - left: Get.width * .051, - right: Get.width * .051, - child: scanDocumentsByApi.isLoading - ? Column( - children: [ - const MyCircularProgressIndicator(), - Text( - 'We are process picture please wait '.tr, - style: AppStyle.title, - ) - ], - ) - : Column( - children: [ - Container( - decoration: AppStyle.boxDecoration, - height: Get.height * .35, - child: Padding( - padding: const EdgeInsets.all(5), - child: Center( - child: Text( - 'There is no data yet.'.tr, - style: AppStyle.title, - ), - )), - ), - ], - ), - ), - ); - } - - GetBuilder usaDriverLicensWidget() { - return GetBuilder( - builder: (scanDocumentsByApi) => scanDocumentsByApi.responseMap.isNotEmpty - ? Positioned( - top: Get.height * .06, - left: Get.width * .051, - right: Get.width * .051, - child: scanDocumentsByApi.isLoading - ? Column( - children: [ - const MyCircularProgressIndicator(), - Text( - 'We are process picture please wait '.tr, - style: AppStyle.title, - ) - ], - ) - : Column( - children: [ - Container( - decoration: AppStyle.boxDecoration, - height: Get.height * .4, - child: Padding( - padding: const EdgeInsets.all(5), - child: scanDocumentsByApi.responseMap.isEmpty - ? Center( - child: Text( - 'There is no data yet.'.tr, - style: AppStyle.title, - ), - ) - : Column( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - '${'Name :'.tr}${scanDocumentsByApi.name}', - style: AppStyle.subtitle, - ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - Text( - '${'Drivers License Class: '.tr}${scanDocumentsByApi.licenseClass}', - style: AppStyle.title, - ), - Image.memory( - scanDocumentsByApi - .imageSignature, - width: 100, - height: 30, - ), - ], - ), - ], - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '${'Document Number: '.tr}${scanDocumentsByApi.documentNo}', - style: AppStyle.title, - ), - Image.memory( - scanDocumentsByApi.imagePortrait, - width: 60, - ), - ]), - Text( - '${'Address: '.tr}${scanDocumentsByApi.address}', - style: AppStyle.title, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '${'Height: '.tr}${scanDocumentsByApi.height}', - style: AppStyle.subtitle, - ), - Text( - 'Postal Code: ${scanDocumentsByApi.postalCode}', - style: AppStyle.subtitle, - ), - Text( - 'Sex: ${scanDocumentsByApi.sex}', - style: AppStyle.subtitle, - ), - ], - ), - Text( - 'Territorial Code: ${scanDocumentsByApi.stateCode}', - style: AppStyle.subtitle, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '${'Expiry Date: '.tr}${scanDocumentsByApi.expireDate}', - style: DateTime.parse( - scanDocumentsByApi - .responseMap['data'] - ['ocr'] - ['dateOfExpiry'] - .toString()) - .isBefore( - scanDocumentsByApi.now) - ? AppStyle.title.copyWith( - color: AppColor.redColor) - : AppStyle.title.copyWith( - color: AppColor.greenColor), - ), - Text( - '${'Date of Birth: '.tr}${scanDocumentsByApi.dob}', - style: AppStyle.title, - ), - ], - ), - ], - ), - ), - ), - DateTime.parse(scanDocumentsByApi.responseMap['data'] - ['ocr']['dateOfExpiry'] - .toString()) - .isBefore(scanDocumentsByApi.now) - ? Text( - 'You can\'t continue with us .\nYou should renew Driver license', - style: AppStyle.title - .copyWith(color: AppColor.redColor), - ) - : MyElevatedButton( - title: 'Detect Your Face '.tr, - onPressed: () => - scanDocumentsByApi.checkMatchFaceApi(), - ), - scanDocumentsByApi.res.isEmpty - ? const SizedBox() - : scanDocumentsByApi.res['data']['result'] - .toString() == - 'Same' - ? MyElevatedButton( - onPressed: () async { - await registerCaptainController - .register(); - await registerCaptainController - .addLisence(); - // await scanDocumentsByApi - // .uploadImagePortrate(); - }, - title: - 'Go to next step\nscan Car License.'.tr, - kolor: AppColor.greenColor, - ) - : const SizedBox(), - MyElevatedButton( - title: 'get sql data', - kolor: AppColor.yellowColor, - onPressed: () { - sql.deleteAllData(TableName.faceDetectTimes); - sql.getAllData(TableName.faceDetectTimes).then( - (value) => print(value[0]['faceDetectTimes'])); - }, - ) - ], - ), - ) - : Positioned( - top: Get.height * .06, - left: Get.width * .051, - right: Get.width * .051, - child: scanDocumentsByApi.isLoading - ? Column( - children: [ - const MyCircularProgressIndicator(), - Text( - 'We are process picture please wait '.tr, - style: AppStyle.title, - ) - ], - ) - : Column( - children: [ - Container( - decoration: AppStyle.boxDecoration, - height: Get.height * .35, - child: Padding( - padding: const EdgeInsets.all(5), - child: Center( - child: Text( - 'There is no data yet.'.tr, - style: AppStyle.title, - ), - )), - ), - ], - ), - ), - ); - } -} - -class EgyptDocuments extends StatelessWidget { - const EgyptDocuments({ - super.key, - required this.contentController, - }); - - final AI contentController; - - @override - Widget build(BuildContext context) { - return Positioned( - top: 3, - left: Get.width * .1, - right: Get.width * .1, - child: MyElevatedButton( - title: 'Take Picture Of ID Card'.tr, //egypt - onPressed: () async { - await CRUD().allMethodForAI('name,address,dob,nationalNo,', - AppLink.uploadEgypt, 'idFront'); //egypt - }, - )); - } -} - -class JordanDocumants extends StatelessWidget { - const JordanDocumants({ - super.key, - required this.contentController, - }); - - final AI contentController; - - @override - Widget build(BuildContext context) { - return Positioned( - top: 3, - left: Get.width * .1, - right: Get.width * .1, - child: MyElevatedButton( - title: 'Take Picture Of Driver License Card'.tr, - onPressed: () { - contentController.getDriverLicenseJordanContent(); - }, - )); - } -} - -class UsaAiDocuments extends StatelessWidget { - const UsaAiDocuments({ - super.key, - required this.scanDocumentsByApi, - }); - - final ScanDocumentsByApi scanDocumentsByApi; - - @override - Widget build(BuildContext context) { - return Positioned( - top: 3, - left: Get.width * .2, - right: Get.width * .2, - child: MyElevatedButton( - title: 'Take Picture Of ID Card'.tr, - onPressed: () { - scanDocumentsByApi.scanDocumentsByApi(); - }, - )); - } -} diff --git a/lib/views/auth/captin/camera_widgets/camera_lisence_page.dart b/lib/views/auth/captin/camera_widgets/camera_lisence_page.dart deleted file mode 100644 index 7f3009c..0000000 --- a/lib/views/auth/captin/camera_widgets/camera_lisence_page.dart +++ /dev/null @@ -1,83 +0,0 @@ -import 'package:camera/camera.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; - -import '../../../../constant/colors.dart'; -import '../../../../constant/style.dart'; -import '../../../../controller/functions/camer_controller.dart'; -import '../../../../controller/functions/ocr_controller.dart'; -import '../../../widgets/my_scafold.dart'; - -class CameraLisencePage extends StatelessWidget { - CameraLisencePage.CameraLicensePage({super.key}); - final CameraClassController cameraClassController = - Get.put(CameraClassController()); - - @override - Widget build(BuildContext context) { - return MyScafolld( - title: 'Scan Driver License'.tr, - body: [ - Column(children: [ - Text( - 'Please put your licence in these border'.tr, - style: AppStyle.title.copyWith(color: AppColor.greenColor), - ), - Padding( - padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12), - child: GetBuilder( - builder: (cameraClassController) => - cameraClassController.isCameraInitialized - ? Stack( - children: [ - Container( - decoration: AppStyle.boxDecoration, - child: CameraPreview( - cameraClassController.cameraController, - ), - ), - Positioned( - top: Get.height * .1, - right: 5, - left: 5, - child: Container( - height: Get.width * 3 / 4, - width: Get.width * .9, - decoration: BoxDecoration( - // color: AppColor.blueColor, - border: Border.all( - color: AppColor.yellowColor, width: 2), - ), - ), - ), - ], - ) - : Container( - decoration: AppStyle.boxDecoration, - height: Get.width * 3 / 4, - width: Get.width, - child: Center( - child: Text( - 'Camera not initialized yet', - style: AppStyle.title, - ), - ), - ), - ), - ), - const SizedBox( - height: 20, - ), - MyElevatedButton( - title: 'Take Image'.tr, - onPressed: () { - ScanDocumentsByApi().scanDocumentsByApi(); - }, - ) - ]), - ], - isleading: true, - ); - } -} diff --git a/lib/views/auth/captin/car_license_page.dart b/lib/views/auth/captin/car_license_page.dart deleted file mode 100644 index 409b565..0000000 --- a/lib/views/auth/captin/car_license_page.dart +++ /dev/null @@ -1,170 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/controller/functions/ocr_controller.dart'; - -import '../../../constant/style.dart'; -import '../../../controller/auth/captin/ml_google_doc.dart'; -import '../../../controller/auth/captin/register_captin_controller.dart'; -import '../../widgets/elevated_btn.dart'; -import '../../widgets/my_scafold.dart'; - -class CarLicensePage extends StatelessWidget { - CarLicensePage({super.key}); - CarRegistrationRecognizerController carRegistrationRecognizerController = - Get.put(CarRegistrationRecognizerController()); - RegisterCaptainController registerCaptainController = - Get.put(RegisterCaptainController()); - - @override - Widget build(BuildContext context) { - Get.find().uploadImagePortrate(); - return MyScafolld( - title: 'Car License Card'.tr, - body: [ - Positioned( - top: 3, - left: Get.width * .2, - right: Get.width * .2, - child: MyElevatedButton( - title: 'Take Picture Of ID Card'.tr, - onPressed: () async { - //0vQRyaYYDWpsv73A5CZOknseK7S2sgwE - //3vQRyaYYSWpmv69A58ZOkxmeK6M1mgwEDlXrXlBl - //0pALdqDDYHvzp73Q59SIgbzjG7Z2zkhJXr - // String? visionApi = AK.serverPHP; - // print(AK.visionApi); - await carRegistrationRecognizerController.scanText(); - }, - )), - Positioned( - top: 50, - child: SizedBox( - height: Get.height * .6, - width: Get.width, - child: buildImageWithBoundingBoxes(), - ), - ), - Positioned( - bottom: Get.height * .2, - left: Get.width * .2, - right: Get.width * .2, - child: MyElevatedButton( - title: 'Register'.tr, - onPressed: () async { - // registerCaptainController.addLisence(); - // registerCaptainController.register(); - registerCaptainController.addRegisrationCarForDriver( - carRegistrationRecognizerController.extracted['vin'], - carRegistrationRecognizerController.extracted['make'], - carRegistrationRecognizerController.extracted['model'], - carRegistrationRecognizerController.extracted['year'], - carRegistrationRecognizerController.extracted['color'], - carRegistrationRecognizerController.extracted['owner'], - carRegistrationRecognizerController - .extracted['expiration_date'], - carRegistrationRecognizerController - .extracted['registration_date'], - ); - }, - )), - ], - isleading: true); - } -} - -Widget buildImageWithBoundingBoxes() { - Get.put(CarRegistrationRecognizerController()); - return GetBuilder( - builder: (carRegistrationRecognizerController) => - carRegistrationRecognizerController.image == null || - carRegistrationRecognizerController.extracted.isEmpty - ? Center( - child: Text( - 'No image selected yet'.tr, - style: AppStyle.headTitle2, - )) - : Column( - children: [ - SizedBox( - width: Get.width * .8, - height: Get.width * .5, - child: Image.file( - File(carRegistrationRecognizerController - .croppedFile!.path), - // fit: BoxFit.fill, - )), - const SizedBox( - height: 20, - ), - Container( - decoration: AppStyle.boxDecoration, - height: Get.width * .5, - width: Get.width * .9, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Text( - '${'Made :'.tr}${carRegistrationRecognizerController.extracted['make']}', - style: AppStyle.title, - ), - Text( - '${'model :'.tr}${carRegistrationRecognizerController.extracted['model']}', - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Text( - '${'VIN :'.tr}${carRegistrationRecognizerController.extracted['vin']}', - style: AppStyle.title, - ), - Text( - '${'year :'.tr}${carRegistrationRecognizerController.extracted['year']}', - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Column( - children: [ - Text( - 'expiration date :${carRegistrationRecognizerController.extracted['expiration_date']}', - style: AppStyle.title, - ), - Text( - 'registration date :${carRegistrationRecognizerController.extracted['registration_date']}', - style: AppStyle.title, - ), - ], - ), - Text( - 'color :${carRegistrationRecognizerController.extracted['color']}', - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Text( - 'owner :${carRegistrationRecognizerController.extracted['owner']}', - style: AppStyle.title, - ), - ], - ), - ], - ), - ) - ], - )); -} diff --git a/lib/views/auth/captin/forget.dart b/lib/views/auth/captin/forget.dart deleted file mode 100644 index e69de29..0000000 diff --git a/lib/views/auth/captin/login_captin.dart b/lib/views/auth/captin/login_captin.dart deleted file mode 100644 index 52eb36d..0000000 --- a/lib/views/auth/captin/login_captin.dart +++ /dev/null @@ -1,323 +0,0 @@ -import 'package:SEFER/constant/api_key.dart'; -import 'package:animated_text_kit/animated_text_kit.dart'; -import 'package:flutter/gestures.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; -import 'package:get/get.dart'; - -import '../../../constant/box_name.dart'; -import '../../../constant/char_map.dart'; -import '../../../constant/colors.dart'; -import '../../../constant/credential.dart'; -import '../../../constant/info.dart'; -import '../../../constant/style.dart'; -import '../../../controller/auth/captin/login_captin_controller.dart'; -import '../../../controller/auth/login_controller.dart'; -import '../../../main.dart'; -import '../../home/profile/passenger_profile_page.dart'; -import '../../widgets/elevated_btn.dart'; -import '../../widgets/my_scafold.dart'; -import '../../widgets/mycircular.dart'; -import 'register_captin.dart'; - -class LoginCaptin extends StatelessWidget { - final controller = Get.put(LoginController()); - - LoginCaptin({super.key}); - - @override - Widget build(BuildContext context) { - Get.put(LoginCaptinController()); - - return GetBuilder( - builder: (controller) => MyScafolld( - title: 'Login Driver'.tr, - isleading: true, - body: [ - if (box.read(BoxName.agreeTerms) != 'agreed') - agreedPage() - else if (box.read(BoxName.countryCode) == null) - CountryPicker() - else - SingleChildScrollView( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(25), - child: Container( - decoration: const BoxDecoration( - boxShadow: [ - BoxShadow( - offset: Offset(3, 3), - color: AppColor.accentColor, - blurRadius: 3) - ], - color: AppColor.secondaryColor, - ), - child: Form( - key: controller.formKey, - child: Padding( - padding: const EdgeInsets.all(16.0), - child: SingleChildScrollView( - child: Column( - children: [ - TextFormField( - keyboardType: TextInputType.emailAddress, - controller: controller.emailController, - decoration: InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide( - color: AppColor.primaryColor, - width: 2.0, - ), - borderRadius: BorderRadius.circular(10), - ), - fillColor: AppColor.accentColor, - hoverColor: AppColor.accentColor, - focusColor: AppColor.accentColor, - border: const OutlineInputBorder( - borderRadius: BorderRadius.all( - Radius.circular(12))), - labelText: 'Email'.tr, - hintText: 'Enter your email address'.tr, - ), - validator: (value) { - if (value!.isEmpty || - (!value.contains('@') || - !value.contains('.'))) { - return 'Please enter Your Email.'.tr; - } - return null; - }, - ), - const SizedBox( - height: 30, - ), - TextFormField( - keyboardType: TextInputType.phone, - cursorColor: AppColor.accentColor, - controller: controller.phoneController, - decoration: InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide( - color: AppColor.primaryColor, - width: 2.0, - ), - borderRadius: BorderRadius.circular(10), - ), - focusColor: AppColor.accentColor, - fillColor: AppColor.accentColor, - border: const OutlineInputBorder( - borderRadius: BorderRadius.all( - Radius.circular(12))), - labelText: 'Phone'.tr, - hintText: 'Enter your phone number'.tr, - ), - validator: (value) { - if (value!.isEmpty || - value.length != 10) { - return 'Please enter your phone number.' - .tr; - } - return null; - }, - ), - const SizedBox( - height: 15, - ), - TextFormField( - obscureText: true, - keyboardType: TextInputType.emailAddress, - controller: controller.passwordController, - decoration: InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: const BorderSide( - color: AppColor.primaryColor, - width: 2.0, - ), - borderRadius: BorderRadius.circular(10), - ), - fillColor: AppColor.accentColor, - hoverColor: AppColor.accentColor, - focusColor: AppColor.accentColor, - border: const OutlineInputBorder( - borderRadius: BorderRadius.all( - Radius.circular(12))), - labelText: 'Password'.tr, - hintText: - 'Please enter your phone number.'.tr, - ), - validator: (value) { - if (value!.isEmpty) { - return 'Please enter Your Password.'.tr; - } - if (value.length < 6) { - return 'Password must br at least 6 character.' - .tr; - } - return null; - }, - ), - GetBuilder( - builder: (controller) => controller - .isloading - ? const MyCircularProgressIndicator() - : MyElevatedButton( - onPressed: () { - if (controller - .formKey.currentState! - .validate()) { - controller.login(); - } - }, - title: 'Submit'.tr, - ), - ) - ], - ), - ), - ), - ), - )), - Text( - 'if you don\'t have account'.tr, - style: AppStyle.subtitle, - ), - AnimatedTextKit( - onTap: () => Get.to(() => const RegisterCaptin()), - animatedTexts: [ - TypewriterAnimatedText( - 'Register as Driver'.tr, - textStyle: AppStyle.headTitle2, - speed: const Duration(milliseconds: 200), - ), - ], - totalRepeatCount: 4, - pause: const Duration(milliseconds: 200), - displayFullTextOnTap: true, - stopPauseOnTap: true, - ), - // IconButton( - // onPressed: () async { - // AC credentials = AC(); - // String apiKey = AK.payMobApikey; - // String convertedStringN = credentials.c( - // credentials.c(credentials.c(apiKey, cs), cC), cn); - // print('Converted v: $convertedStringN'); - // - // String retrievedStringS = credentials.r( - // credentials.r( - // credentials.r(convertedStringN, cn), cC), - // cs); - // print('Retrieved String: $retrievedStringS'); - // // - // if (retrievedStringS == apiKey) { - // print('same'); - // } - // }, - // icon: const Icon( - // Icons.close, - // color: AppColor.blueColor, - // ), - // ), - ], - ), - ) - ], - ), - ); - } - - Padding agreedPage() { - return Padding( - padding: const EdgeInsets.all(16), - child: SingleChildScrollView( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Image.asset( - 'assets/images/notepad.png', - width: Get.width * .2, - ), - SizedBox( - width: Get.width * .7, - child: Text( - 'Accept Ride\'s Terms & Review Privacy Notice'.tr, - style: AppStyle.headTitle2, - ), - ), - ], - ), - const SizedBox( - height: 30, - ), - RichText( - text: TextSpan( - text: - 'By selecting "I Agree" below, I have reviewed and agree to the Terms of Use and acknowledge the ' - .tr, - style: AppStyle.title, - children: [ - TextSpan( - text: 'Privacy Notice'.tr, - style: const TextStyle( - decoration: TextDecoration.underline, - color: AppColor.blueColor), - recognizer: TapGestureRecognizer() - ..onTap = () { - Get.defaultDialog( - title: ''.tr, - content: const SizedBox( - height: 400, - width: 400, - child: SingleChildScrollView( - child: - HtmlWidget(AppInformation.privacyPolicy), - ), - )); - }), - const TextSpan( - text: '. I am at least 18 years of age.', - ), - ], - ), - ), - const SizedBox( - height: 100, - ), - GetBuilder( - builder: (controller) => Column( - children: [ - Row( - children: [ - Checkbox.adaptive( - autofocus: true, - tristate: true, - splashRadius: 25, - activeColor: AppColor.primaryColor, - value: controller.isAgreeTerms, - onChanged: (value) => controller.changeAgreeTerm(), - ), - Text( - 'I Agree'.tr, - style: controller.isAgreeTerms - ? AppStyle.title - : AppStyle.title - .copyWith(color: AppColor.accentColor), - ), - ], - ), - MyElevatedButton( - title: 'Submit'.tr, - onPressed: () => controller.saveAgreementTerms()), - ], - ), - ) - ], - ), - ), - ); - } -} diff --git a/lib/views/auth/captin/logout_captain.dart b/lib/views/auth/captin/logout_captain.dart deleted file mode 100644 index b4e51dd..0000000 --- a/lib/views/auth/captin/logout_captain.dart +++ /dev/null @@ -1,42 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/controller/functions/log_out.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; - -class LogoutCaptain extends StatelessWidget { - const LogoutCaptain({super.key}); - - @override - Widget build(BuildContext context) { - return MyScafolld( - title: 'Log Out Page'.tr, - body: [ - Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - MyElevatedButton( - title: 'Log Off'.tr, - onPressed: () { - LogOutController().logOutCaptain(); - }), - const SizedBox( - height: 30, - ), - MyElevatedButton( - title: 'Delete My Account'.tr, - onPressed: () { - LogOutController().deletecaptainAccount(); - }, - kolor: AppColor.redColor, - ), - ], - ), - ) - ], - isleading: true, - ); - } -} diff --git a/lib/views/auth/captin/register_captin.dart b/lib/views/auth/captin/register_captin.dart deleted file mode 100644 index 11929b0..0000000 --- a/lib/views/auth/captin/register_captin.dart +++ /dev/null @@ -1,167 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/controller/auth/captin/register_captin_controller.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; - -import '../../../constant/colors.dart'; -import '../../../controller/auth/google_sign.dart'; - -class RegisterCaptin extends StatelessWidget { - const RegisterCaptin({super.key}); - - @override - Widget build(BuildContext context) { - Get.put(RegisterCaptainController()); - return MyScafolld( - title: 'Register Driver'.tr, - body: [ - // GetBuilder( - // builder: (controller) => Form( - // key: controller.formKey, - // child: Padding( - // padding: const EdgeInsets.all(16.0), - // child: SingleChildScrollView( - // child: Container( - // decoration: const BoxDecoration( - // boxShadow: [ - // BoxShadow( - // offset: Offset(3, 3), - // color: AppColor.accentColor, - // blurRadius: 3) - // ], - // color: AppColor.secondaryColor, - // ), - // child: Padding( - // padding: const EdgeInsets.all(16), - // child: Column( - // children: [ - // SizedBox( - // width: Get.width * .8, - // child: TextFormField( - // keyboardType: TextInputType.emailAddress, - // controller: controller.emailController, - // decoration: InputDecoration( - // focusedBorder: OutlineInputBorder( - // borderSide: const BorderSide( - // color: AppColor.primaryColor, - // width: 2.0, - // ), - // borderRadius: BorderRadius.circular(10), - // ), - // fillColor: AppColor.accentColor, - // hoverColor: AppColor.accentColor, - // focusColor: AppColor.accentColor, - // border: const OutlineInputBorder( - // borderRadius: - // BorderRadius.all(Radius.circular(12))), - // labelText: 'Email'.tr, - // hintText: 'Enter your email address'.tr, - // ), - // validator: (value) { - // if (value!.isEmpty || - // (!value.contains('@') || - // !value.contains('.'))) { - // return 'Please enter Your Email.'.tr; - // } - // return null; - // }, - // ), - // ), - // const SizedBox( - // height: 15, - // ), - // SizedBox( - // width: Get.width * .8, - // child: TextFormField( - // obscureText: true, - // keyboardType: TextInputType.emailAddress, - // controller: controller.passwordController, - // decoration: InputDecoration( - // focusedBorder: OutlineInputBorder( - // borderSide: const BorderSide( - // color: AppColor.primaryColor, - // width: 2.0, - // ), - // borderRadius: BorderRadius.circular(10), - // ), - // fillColor: AppColor.accentColor, - // hoverColor: AppColor.accentColor, - // focusColor: AppColor.accentColor, - // border: const OutlineInputBorder( - // borderRadius: - // BorderRadius.all(Radius.circular(12))), - // labelText: 'Password'.tr, - // hintText: 'Enter your Password'.tr, - // ), - // validator: (value) { - // if (value!.isEmpty) { - // return 'Please enter Your Password.'.tr; - // } - // if (value.length < 6) { - // return 'Password must br at least 6 character.' - // .tr; - // } - // return null; - // }, - // ), - // ), - // const SizedBox( - // height: 15, - // ), - // SizedBox( - // width: Get.width * .8, - // child: TextFormField( - // keyboardType: TextInputType.phone, - // cursorColor: AppColor.accentColor, - // controller: controller.phoneController, - // decoration: InputDecoration( - // focusedBorder: OutlineInputBorder( - // borderSide: const BorderSide( - // color: AppColor.primaryColor, - // width: 2.0, - // ), - // borderRadius: BorderRadius.circular(10), - // ), - // focusColor: AppColor.accentColor, - // fillColor: AppColor.accentColor, - // border: const OutlineInputBorder( - // borderRadius: - // BorderRadius.all(Radius.circular(12))), - // labelText: 'Phone'.tr, - // hintText: 'Enter your phone number'.tr, - // ), - // validator: (value) { - // if (value!.isEmpty || value.length != 10) { - // return 'Please enter your phone number.'.tr; - // } - // return null; - // }, - // ), - // ), - // const SizedBox( - // height: 15, - // ), - // MyElevatedButton( - // title: 'Next'.tr, - // onPressed: () => controller.nextToAIDetection()), - // ], - // ), - // ), - // ), - // ), - // ), - // ), - // ) - Center( - child: MyElevatedButton( - title: 'Sign In by Google'.tr, - onPressed: () async { - await GoogleSignInHelper.signIn(); - }, - kolor: AppColor.blueColor, - )) - ], - isleading: true); - } -} diff --git a/lib/views/auth/captin/verify_email_captain.dart b/lib/views/auth/captin/verify_email_captain.dart deleted file mode 100644 index 77a97df..0000000 --- a/lib/views/auth/captin/verify_email_captain.dart +++ /dev/null @@ -1,91 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/controller/auth/captin/register_captin_controller.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; - -class VerifyEmailCaptainPage extends StatelessWidget { - VerifyEmailCaptainPage({super.key}); - RegisterCaptainController registerCaptinController = - Get.put(RegisterCaptainController()); - @override - Widget build(BuildContext context) { - return MyScafolld( - title: 'Verify Email For Driver'.tr, - body: [ - Positioned( - top: 10, - left: 20, - child: Text( - 'We sent 5 digit to your Email provided'.tr, - style: AppStyle.title.copyWith(fontSize: 20), - )), - GetBuilder( - builder: (controller) => Positioned( - top: 100, - left: 80, - right: 80, - child: Padding( - padding: const EdgeInsets.all(10), - child: Column( - children: [ - SizedBox( - width: 100, - child: TextField( - controller: registerCaptinController.verifyCode, - decoration: InputDecoration( - labelStyle: AppStyle.title, - border: const OutlineInputBorder(), - hintText: '5 digit'.tr, - counterStyle: AppStyle.number, - hintStyle: AppStyle.subtitle - .copyWith(color: AppColor.accentColor), - ), - maxLength: 5, - keyboardType: TextInputType.number, - ), - ), - const SizedBox( - height: 30, - ), - MyElevatedButton( - title: 'Send Verfication Code'.tr, - onPressed: () { - registerCaptinController.sendVerifications(); - }) - ], - ), - ), - )), - ], - isleading: true, - ); - } - - Padding verifyEmail() { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 10), - child: Container( - decoration: BoxDecoration( - border: Border.all( - color: AppColor.accentColor, - width: 2, - ), - borderRadius: BorderRadius.circular(8), - ), - child: const Padding( - padding: EdgeInsets.all(10), - child: SizedBox( - width: 20, - child: TextField( - maxLength: 1, - keyboardType: TextInputType.number, - ), - ), - ), - ), - ); - } -} diff --git a/lib/views/auth/login_page.dart b/lib/views/auth/login_page.dart index 5e26963..29a0e91 100644 --- a/lib/views/auth/login_page.dart +++ b/lib/views/auth/login_page.dart @@ -7,7 +7,6 @@ import 'package:SEFER/constant/box_name.dart'; import 'package:SEFER/constant/colors.dart'; import 'package:SEFER/constant/style.dart'; import 'package:SEFER/main.dart'; -import 'package:SEFER/views/auth/captin/login_captin.dart'; import 'package:SEFER/views/widgets/elevated_btn.dart'; import 'package:SEFER/views/widgets/my_scafold.dart'; import 'package:SEFER/views/widgets/my_textField.dart'; @@ -30,46 +29,6 @@ class LoginPage extends StatelessWidget { builder: (controller) => MyScafolld( title: 'Login'.tr, isleading: false, - action: GestureDetector( - onLongPress: () { - Get.defaultDialog( - title: 'Admin DashBoard', - titleStyle: AppStyle.title, - content: Form( - key: controller.formKeyAdmin, - child: Column( - children: [ - MyTextForm( - controller: controller.adminNameController, - label: 'Your name'.tr, - hint: 'Your name', - type: TextInputType.name), - const SizedBox( - height: 10, - ), - MyTextForm( - controller: controller.adminPasswordController, - label: 'Your password'.tr, - hint: 'Your password', - type: TextInputType.emailAddress), - const SizedBox( - height: 10, - ), - ], - ), - ), - confirm: MyElevatedButton( - title: 'title'.tr, - onPressed: () { - controller.adminDashboardOpen(); - }, - ), - ); - }, - child: const Icon( - Icons.dashboard, - color: AppColor.redColor, - )), body: [ if (box.read(BoxName.agreeTerms) != 'agreed') agreedPage() @@ -238,29 +197,29 @@ class LoginPage extends StatelessWidget { const SizedBox( height: 100, ), - GestureDetector( - onTap: () => Get.to(LoginCaptin()), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - const Icon( - Icons.drive_eta_rounded, - size: 50, - ), - Text( - 'If You Want be Driver \nClick Here.'.tr, - style: AppStyle.headTitle2, - textAlign: TextAlign.center, - ), - ], - ), - ), - IconButton( - onPressed: () { - box.remove(BoxName.countryCode); - }, - icon: const Icon(Icons.delete), - ), + // GestureDetector( + // onTap: () => Get.to(LoginCaptin()), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + // children: [ + // const Icon( + // Icons.drive_eta_rounded, + // size: 50, + // ), + // Text( + // 'If You Want be Driver \nClick Here.'.tr, + // style: AppStyle.headTitle2, + // textAlign: TextAlign.center, + // ), + // ], + // ), + // ), + // IconButton( + // onPressed: () { + // box.remove(BoxName.countryCode); + // }, + // icon: const Icon(Icons.delete), + // ), ], ), ) diff --git a/lib/views/home/Captin/bottom_bar.dart b/lib/views/home/Captin/bottom_bar.dart deleted file mode 100644 index c08f3b0..0000000 --- a/lib/views/home/Captin/bottom_bar.dart +++ /dev/null @@ -1,119 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/colors.dart'; - -class BottomBarController extends GetxController { - var currentIndex = 0.obs; - - void changePage(int index) { - currentIndex.value = index; - } -} - -class HomeScreen extends StatelessWidget { - final BottomBarController controller = Get.put(BottomBarController()); - - HomeScreen({super.key}); - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text('Bottom Bar Example'.tr), - ), - body: Obx(() => IndexedStack( - index: controller.currentIndex.value, - children: const [ - HomeView(), - ProfileView(), - StatisticsView(), - WalletView(), - ], - )), - bottomNavigationBar: Obx(() => BottomNavigationBar( - backgroundColor: Colors.greenAccent, - currentIndex: controller.currentIndex.value, - onTap: controller.changePage, - items: [ - BottomNavigationBarItem( - icon: const Icon( - Icons.home, - color: AppColor.primaryColor, - ), - label: 'Home'.tr, - ), - BottomNavigationBarItem( - icon: const Icon( - Icons.person, - color: AppColor.primaryColor, - ), - label: 'Profile'.tr, - ), - BottomNavigationBarItem( - icon: const Icon( - Icons.bar_chart, - color: AppColor.primaryColor, - ), - label: 'Statistics'.tr, - ), - BottomNavigationBarItem( - icon: const Icon( - Icons.account_balance_wallet, - color: AppColor.primaryColor, - ), - label: 'Wallet'.tr, - ), - ], - )), - ); - } -} - -class HomeView extends StatelessWidget { - const HomeView({super.key}); - - @override - Widget build(BuildContext context) { - Map data; - return const Center( - child: Column( - children: [ - Text('Home View'), - ], - ), - ); - } -} - -class ProfileView extends StatelessWidget { - const ProfileView({super.key}); - - @override - Widget build(BuildContext context) { - return const Center( - child: Text('Profile View'), - ); - } -} - -class StatisticsView extends StatelessWidget { - const StatisticsView({super.key}); - - @override - Widget build(BuildContext context) { - return const Center( - child: Text('Statistics View'), - ); - } -} - -class WalletView extends StatelessWidget { - const WalletView({super.key}); - - @override - Widget build(BuildContext context) { - return const Center( - child: Text('Wallet View'), - ); - } -} diff --git a/lib/views/home/Captin/camer_widget.dart b/lib/views/home/Captin/camer_widget.dart deleted file mode 100644 index ed23ed0..0000000 --- a/lib/views/home/Captin/camer_widget.dart +++ /dev/null @@ -1,305 +0,0 @@ -import 'package:camera/camera.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/controller/functions/camer_controller.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; - -class CameraWidgetCardId extends StatelessWidget { - final CameraClassController cameraClassController = - Get.put(CameraClassController()); - - CameraWidgetCardId({super.key}); - - @override - Widget build(BuildContext context) { - return MyScafolld( - title: 'Scan Id'.tr, - body: [ - Column( - children: [ - Padding( - padding: - const EdgeInsets.symmetric(vertical: 8, horizontal: 12), - child: GetBuilder( - builder: (cameraClassController) => - cameraClassController.isCameraInitialized - ? Stack( - children: [ - Container( - decoration: AppStyle.boxDecoration, - child: FittedBox( - fit: BoxFit.fitWidth, - child: SizedBox( - width: Get.width * .9, - height: Get.width * - .9, // Set the desired aspect ratio here - child: CameraPreview( - cameraClassController.cameraController, - ), - ), - ), - ), - Positioned( - top: 72, - child: Container( - width: 230, - height: 25, - decoration: BoxDecoration( - // color: AppColor.blueColor, - border: Border.all( - color: AppColor.yellowColor, - width: 2), - ), - ), - ), - Positioned( - top: 60, - right: 5, - child: Container( - width: 230, - height: 25, - decoration: BoxDecoration( - // color: AppColor.blueColor, - border: Border.all( - color: AppColor.blueColor, width: 2), - ), - ), - ), - Positioned( - top: 156, - right: 5, - child: Container( - width: 140, - height: 20, - decoration: BoxDecoration( - // color: AppColor.blueColor, - border: Border.all( - color: AppColor.blueColor, width: 2), - ), - ), - ), - Positioned( - top: 175, - right: 5, - child: Container( - width: 140, - height: 15, - decoration: BoxDecoration( - // color: AppColor.blueColor, - border: Border.all( - color: AppColor.blueColor, width: 2), - ), - ), - ), - Positioned( - top: 191, - right: 5, - child: Container( - width: 140, - height: 15, - decoration: BoxDecoration( - // color: AppColor.blueColor, - border: Border.all( - color: AppColor.blueColor, width: 2), - ), - ), - ), - Positioned( - top: 207, - right: 5, - child: Container( - width: 140, - height: 15, - decoration: BoxDecoration( - // color: AppColor.blueColor, - border: Border.all( - color: AppColor.blueColor, width: 2), - ), - ), - ), - Positioned( - top: 225, - right: 5, - child: Container( - width: 140, - height: 15, - decoration: BoxDecoration( - // color: AppColor.blueColor, - border: Border.all( - color: AppColor.blueColor, width: 2), - ), - ), - ), - Positioned( - top: 115, - left: 25, - child: Container( - width: 120, - height: 110, - decoration: BoxDecoration( - // color: AppColor.blueColor, - border: Border.all( - color: AppColor.blueColor, width: 2), - ), - ), - ), - ], - ) - : Container( - decoration: AppStyle.boxDecoration, - height: Get.width * 3 / 4, - width: Get.width, - child: Center( - child: Text( - 'Camera not initilaized yet'.tr, - style: AppStyle.title, - ), - ), - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - MyElevatedButton( - title: 'Scan ID MklGoogle'.tr, - onPressed: () => - cameraClassController.takePictureAndMLGoogleScan()), - MyElevatedButton( - title: 'Scan ID Tesseract'.tr, onPressed: () {}), - ], - ), - MyElevatedButton( - title: 'Scan ID Api'.tr, - onPressed: () => cameraClassController.extractCardId()), - GetBuilder( - builder: (cameraClassController) => Expanded( - child: - Text(cameraClassController.scannedText.toString()))) - ], - ) - ], - isleading: true); - } -} - -class CameraWidgetPassPort extends StatelessWidget { - final CameraClassController cameraClassController = - Get.put(CameraClassController()); - - CameraWidgetPassPort({super.key}); - - @override - Widget build(BuildContext context) { - return MyScafolld( - title: 'Scan Id'.tr, - body: [ - Column( - children: [ - Padding( - padding: - const EdgeInsets.symmetric(vertical: 8, horizontal: 12), - child: GetBuilder( - builder: (cameraClassController) => - cameraClassController.isCameraInitialized - ? Stack( - children: [ - Container( - decoration: AppStyle.boxDecoration, - child: FittedBox( - fit: BoxFit.fitWidth, - child: SizedBox( - width: Get.width * .9, - height: Get.width * - .9, // Set the desired aspect ratio here - child: CameraPreview( - cameraClassController.cameraController, - ), - ), - ), - ), - Positioned( - top: 35, - left: 35, - width: Get.width * .77, - height: - 17, //left":95.0,"top":134.0,"width":2909.0,"height":175.0 - child: Container( - // width: 230, - // height: 25, - decoration: BoxDecoration( - // color: AppColor.blueColor, - border: Border.all( - color: AppColor.yellowColor, - width: 2), - ), - ), - ), - Positioned( - top: 60, - right: 25, - width: 90, - height: 25, - child: Container( - decoration: BoxDecoration( - // color: AppColor.blueColor, - border: Border.all( - color: AppColor.blueColor, width: 2), - ), - ), - ), - Positioned( - top: 110, - right: 90, - child: Container( - width: 140, - height: 20, - decoration: BoxDecoration( - // color: AppColor.blueColor, - border: Border.all( - color: AppColor.blueColor, width: 2), - ), - ), - ), - ], - ) - : Container( - decoration: AppStyle.boxDecoration, - height: Get.width * 3 / 4, - width: Get.width, - child: Center( - child: Text( - 'Camera not initilaized yet', - style: AppStyle.title, - ), - ), - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - MyElevatedButton( - title: 'Scan ID MklGoogle'.tr, - onPressed: () => - cameraClassController.takePictureAndMLGoogleScan()), - MyElevatedButton( - title: 'Scan ID Tesseract'.tr, onPressed: () {}), - ], - ), - MyElevatedButton( - title: 'Scan ID Api'.tr, - onPressed: () => cameraClassController.extractCardId()), - GetBuilder( - builder: (cameraClassController) => Expanded( - child: - Text(cameraClassController.scannedText.toString()))) - ], - ) - ], - isleading: true); - } -} diff --git a/lib/views/home/Captin/driver_map_page.dart b/lib/views/home/Captin/driver_map_page.dart deleted file mode 100644 index 1e97e78..0000000 --- a/lib/views/home/Captin/driver_map_page.dart +++ /dev/null @@ -1,87 +0,0 @@ -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/controller/home/captin/map_driver_controller.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; - -import '../../../controller/functions/location_controller.dart'; -import '../../Rate/rate_passenger.dart'; -import 'mapDriverWidgets/driver_end_ride_bar.dart'; -import 'mapDriverWidgets/google_driver_map_page.dart'; -import 'mapDriverWidgets/google_map_app.dart'; -import 'mapDriverWidgets/passenger_info_window.dart'; -import 'mapDriverWidgets/sos_connect.dart'; - -class PassengerLocationMapPage extends StatelessWidget { - PassengerLocationMapPage({super.key}); - final LocationController locationController = Get.put(LocationController()); - final MapDriverController mapDriverController = - Get.put(MapDriverController()); - @override - Widget build(BuildContext context) { - // Get.put(MapDriverController()); - - return MyScafolld( - title: 'Map Passenger'.tr, - body: [ - GoogleDriverMap(locationController: locationController), - const PassengerInfoWindow(), - driverEndRideBar(), - const SosConnect(), - speedCircle(), - const GoogleMapApp(), - PricesWindow(), - ], - isleading: false); - } -} - -class PricesWindow extends StatelessWidget { - const PricesWindow({ - super.key, - }); - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (mapDriverController) { - return mapDriverController.isPriceWindow - ? Positioned( - bottom: Get.height * 1.2, - // top: Get.height * 3, - left: Get.height * 1, - right: Get.height * 1, - child: Container( - height: Get.height * 3, - decoration: AppStyle.boxDecoration1, - child: Column( - children: [ - Container( - decoration: AppStyle.boxDecoration1, - child: Padding( - padding: const EdgeInsets.all(3), - child: Text( - 'Total Price is '.tr, - style: AppStyle.headTitle2, - textAlign: TextAlign.center, - ), - )), - const SizedBox( - height: 20, - ), - MyElevatedButton( - title: 'ok'.tr, - onPressed: () => - Get.to(() => RatePassenger(), arguments: { - 'rideId': mapDriverController.rideId, - 'passengerId': mapDriverController.passengerId, - 'driverId': mapDriverController.driverId - })) - ], - ), - ), - ) - : const SizedBox(); - }); - } -} diff --git a/lib/views/home/Captin/history/history_captain.dart b/lib/views/home/Captin/history/history_captain.dart deleted file mode 100644 index 07a501a..0000000 --- a/lib/views/home/Captin/history/history_captain.dart +++ /dev/null @@ -1,107 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; - -import '../../../../constant/colors.dart'; -import '../../../../constant/style.dart'; -import '../../../../controller/auth/captin/history_captain.dart'; -import '../../../widgets/elevated_btn.dart'; -import '../../../widgets/my_scafold.dart'; -import '../../../widgets/mycircular.dart'; - -class HistoryCaptain extends StatelessWidget { - const HistoryCaptain({super.key}); - - @override - Widget build(BuildContext context) { - Get.put(HistoryCaptainController()); - return MyScafolld( - title: 'History Page'.tr, - body: [ - GetBuilder( - builder: (historyCaptainController) => historyCaptainController - .isloading - ? const MyCircularProgressIndicator() - : historyCaptainController.historyData['message'].length < 1 - ? Center( - child: Text( - 'No ride Yet.'.tr, - style: AppStyle.headTitle, - ), - ) - : ListView.builder( - itemCount: historyCaptainController - .historyData['message'].length, - itemBuilder: (BuildContext context, int index) { - var list = historyCaptainController - .historyData['message'][index]; - return InkWell( - onTap: () { - list['status'] != 'Cancel' - ? historyCaptainController - .getHistoryDetails(list['order_id']) - : Get.defaultDialog( - title: 'This Trip Cancelled'.tr, - middleText: '', - titleStyle: AppStyle.title, - confirm: MyElevatedButton( - title: 'Ok'.tr, - onPressed: () => Get.back())); - }, - child: Card( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - 'OrderId'.tr, - style: AppStyle.title, - ), - Text( - list['order_id'], - style: AppStyle.subtitle, - ), - ], - ), - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - 'created time'.tr, - style: AppStyle.title, - ), - Text( - list['created_at'], - style: AppStyle.subtitle, - ), - ], - ), - Text( - list['status'], - style: list['status'] == 'Apply' - ? AppStyle.title.copyWith( - color: AppColor.greenColor) - : list['status'] == 'Refused' - ? AppStyle.title.copyWith( - color: AppColor.redColor) - : AppStyle.title.copyWith( - color: AppColor.yellowColor), - ), - ], - ), - ), - ), - ); - }, - )) - ], - isleading: true, - ); - } -} diff --git a/lib/views/home/Captin/history/history_details_page.dart b/lib/views/home/Captin/history/history_details_page.dart deleted file mode 100644 index d8de8ec..0000000 --- a/lib/views/home/Captin/history/history_details_page.dart +++ /dev/null @@ -1,205 +0,0 @@ -import 'package:SEFER/controller/functions/location_controller.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/controller/auth/captin/history_captain.dart'; -import 'package:SEFER/controller/functions/launch.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; - -import '../../../widgets/mycircular.dart'; - -class HistoryDetailsPage extends StatelessWidget { - HistoryDetailsPage({super.key}); - HistoryCaptainController historyCaptainController = - Get.put(HistoryCaptainController()); - @override - Widget build(BuildContext context) { - return MyScafolld( - title: 'Trip Detail'.tr, - body: [ - GetBuilder( - builder: (historyCaptainController) { - var res = historyCaptainController.historyDetailsData['data']; - return historyCaptainController.isloading - ? const MyCircularProgressIndicator() - : SingleChildScrollView( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: Get.width * .8, - decoration: BoxDecoration( - border: Border.all( - color: AppColor.blueColor, width: 2)), - child: TextButton( - onPressed: () { - String mapUrl = - 'https://www.google.com/maps/dir/${res['start_location']}/${res['end_location']}/'; - print(mapUrl); - showInBrowser(mapUrl); - }, - child: Column( - children: [ - SizedBox( - height: Get.height * .2, - width: Get.width * .75, - child: GoogleMap( - initialCameraPosition: CameraPosition( - target: Get.find() - .myLocation, // Assuming passenger location is available - tilt: 80, zoom: 13, - ), - zoomControlsEnabled: true, - // liteModeEnabled: true, - polylines: { - Polyline( - zIndex: 2, - consumeTapEvents: true, - geodesic: true, - endCap: Cap.buttCap, - startCap: Cap.buttCap, - visible: true, - polylineId: const PolylineId('route'), - points: [ - LatLng( - double.parse(res['start_location'] - .toString() - .split(',')[0]), - double.parse(res['start_location'] - .toString() - .split(',')[1]), - ), - LatLng( - double.parse(res['end_location'] - .toString() - .split(',')[0]), - double.parse(res['end_location'] - .toString() - .split(',')[1]), - ) - ], - color: AppColor.primaryColor, - width: 5, - ), - }, - ), - ), - const SizedBox( - height: 10, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - children: [ - Text( - '${'Order ID'.tr} ${res['id']}', - style: AppStyle.title, - ), - Text( - res['date'].toString(), - style: AppStyle.title, - ), - ], - ), - ], - ), - ), - ), - const SizedBox( - height: 10, - ), - Container( - width: Get.width * .8, - decoration: BoxDecoration( - border: Border.all( - color: AppColor.greenColor, width: 2)), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Text( - '${'Price is'.tr} ${res['price_for_driver']}', - style: AppStyle.title, - ), - Text( - '${'Distance is'.tr} ${res['distance']} KM', - style: AppStyle.title, - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - Text( - 'Times of Trip'.tr, - style: AppStyle.title, - ), - const SizedBox( - height: 10, - ), - Container( - width: Get.width * .8, - decoration: BoxDecoration( - border: Border.all( - color: AppColor.redColor, width: 2)), - child: Column( - children: [ - Text( - '${'Time to Passenger is'.tr} ${res['DriverIsGoingToPassenger']}', - style: AppStyle.title, - ), - Text( - '${'TimeStart is'.tr} ${res['rideTimeStart']}', - style: AppStyle.title, - ), - Text( - '${'Time Finish is'.tr} ${res['rideTimeFinish']}', - style: AppStyle.title, - ), - ], - ), - ), - const SizedBox( - height: 10, - ), - Container( - width: Get.width * .8, - decoration: BoxDecoration( - border: Border.all( - color: AppColor.greenColor, width: 2)), - child: Center( - child: Text( - '${'Passenger Name is'.tr} ${res['first_name']} ${res['last_name']} ', - style: AppStyle.title, - ), - ), - ), - const SizedBox( - height: 10, - ), - Container( - width: Get.width * .8, - decoration: BoxDecoration( - border: Border.all( - color: AppColor.yellowColor, width: 2)), - child: Center( - child: Text( - '${'Status is'.tr} ${res['status']}', - style: AppStyle.title, - ), - ), - ), - ], - ), - ), - ); - }) - ], - isleading: true, - ); - } -} diff --git a/lib/views/home/Captin/home_captain/drawer_captain.dart b/lib/views/home/Captin/home_captain/drawer_captain.dart deleted file mode 100644 index bc6101c..0000000 --- a/lib/views/home/Captin/home_captain/drawer_captain.dart +++ /dev/null @@ -1,222 +0,0 @@ -import 'package:SEFER/constant/api_key.dart'; -import 'package:SEFER/constant/links.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/controller/home/captin/home_captain_controller.dart'; -import 'package:SEFER/views/notification/available_rides_page.dart'; -import 'package:SEFER/views/widgets/mycircular.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_rating_bar/flutter_rating_bar.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/box_name.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/main.dart'; -import 'package:SEFER/views/auth/captin/logout_captain.dart'; -import 'package:SEFER/views/home/Captin/history/history_captain.dart'; -import 'package:SEFER/views/home/Captin/home_captain/help_captain.dart'; -import 'package:SEFER/views/home/Captin/settings_captain.dart'; -import 'package:SEFER/views/home/my_wallet/walet_captain.dart'; -import 'package:SEFER/views/home/profile/profile_captain.dart'; -import 'package:SEFER/views/notification/notification_captain.dart'; - -import '../../../../controller/functions/upload_image.dart'; - -class DrawerCaptain extends StatelessWidget { - ImageController imageController = Get.put(ImageController()); - - @override - Widget build(BuildContext context) { - String writeText(int times) { - return '*' * times; - } - - return Drawer( - child: ListView( - children: [ - // Other drawer items - UserAccountsDrawerHeader( - decoration: const BoxDecoration( - color: AppColor.greenColor, - gradient: LinearGradient( - colors: [ - AppColor.primaryColor, - AppColor.secondaryColor, - ], - begin: Alignment.topLeft, - end: Alignment.bottomRight, - ), - ), - currentAccountPictureSize: const Size.square(100), - arrowColor: AppColor.deepPurpleAccent, - accountName: Padding( - padding: const EdgeInsets.symmetric(horizontal: 10), - child: Row( - children: [ - Text( - box.read(BoxName.nameDriver).toString(), - style: AppStyle.title, - ), - const Spacer(), - Column( - children: [ - Text( - Get.find().rating.toString(), - style: AppStyle.number.copyWith(color: Colors.amber), - ), - Container( - // width: Get.width * .4, - padding: const EdgeInsets.symmetric( - horizontal: 4, vertical: 1), - color: AppColor.greenColor, - child: RatingBar.builder( - initialRating: 5, - minRating: 1, - direction: Axis.horizontal, - itemCount: 5, - itemSize: 20, - itemPadding: - const EdgeInsets.symmetric(horizontal: 2), - itemBuilder: (context, _) => const Icon( - Icons.star, - color: Colors.amber, - ), - onRatingUpdate: (rating) {}), - ), - ], - ), - ], - ), - ), - accountEmail: Padding( - padding: const EdgeInsets.symmetric(horizontal: 10), - child: Text( - box.read(BoxName.emailDriver), - style: AppStyle.title, - ), - ), - currentAccountPicture: Stack( - children: [ - GetBuilder(builder: (imageController) { - return imageController.isloading - ? const MyCircularProgressIndicator() - : CircleAvatar( - radius: 45, - backgroundImage: NetworkImage( - '${AK.serverPHP}/portrate_captain_image/${box.read(BoxName.driverID)}.jpg'), - ); - }), - Positioned( - right: 0, - top: 0, - child: IconButton( - onPressed: () { - imageController.choosImage( - AppLink.uploadImage1, 'portrait'); - }, - icon: const Icon(Icons.edit), - ), - ), - ], - ), - ), - - ListTile( - leading: const Icon(Icons.account_balance_wallet), - title: Text( - 'Wallet'.tr, - style: AppStyle.title, - ), - onTap: () { - // Handle wallet item tap - Get.to(() => WalletCaptain(), transition: Transition.native); - }, - ), - ListTile( - leading: const Icon(Icons.person), - title: Text( - 'Profile'.tr, - style: AppStyle.title, - ), - onTap: () { - // Handle profile item tap - Get.to(() => const ProfileCaptain(), - transition: Transition.rightToLeftWithFade); - }, - ), - ListTile( - leading: const Icon( - Icons.history, - ), - title: Text( - 'History of Trip'.tr, - style: AppStyle.title, - ), - onTap: () { - Get.to(() => const HistoryCaptain(), - transition: Transition.downToUp); - // Handle history of trip item tap - }, - ), - ListTile( - leading: const Icon(Icons.phonelink_ring_rounded), - title: Text( - 'Available for rides'.tr, - style: AppStyle.title, - ), - onTap: () { - Get.to(() => const AvailableRidesPage(), - transition: Transition.rightToLeftWithFade); - // Handle history of trip item tap - }, - ), - ListTile( - leading: const Icon(Icons.notifications), - title: Text( - 'Notifications'.tr, - style: AppStyle.title, - ), - onTap: () { - // Handle notifications item tap - Get.to(() => const NotificationCaptain(), - transition: Transition.upToDown); - }, - ), - ListTile( - leading: const Icon(Icons.help), - title: Text( - 'Helping Center'.tr, - style: AppStyle.title, - ), - onTap: () { - // Handle helping center item tap - Get.to(() => HelpCaptain(), transition: Transition.size); - }, - ), - ListTile( - leading: const Icon(Icons.settings), - title: Text( - 'Settings'.tr, - style: AppStyle.title, - ), - onTap: () { - // Handle settings item tap - Get.to(() => const SettingsCaptain(), - transition: Transition.cupertino); - }, - ), - ListTile( - leading: const Icon(Icons.exit_to_app), - title: Text( - 'Sign Out'.tr, - style: AppStyle.title, - ), - onTap: () { - // Handle sign out item tap - Get.to(() => const LogoutCaptain(), - transition: Transition.cupertinoDialog); - }, - ), - ], - ), - ); - } -} diff --git a/lib/views/home/Captin/home_captain/driver_call_page.dart b/lib/views/home/Captin/home_captain/driver_call_page.dart deleted file mode 100644 index d090c2e..0000000 --- a/lib/views/home/Captin/home_captain/driver_call_page.dart +++ /dev/null @@ -1,194 +0,0 @@ -import 'dart:async'; -import 'package:SEFER/constant/box_name.dart'; -import 'package:SEFER/main.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:permission_handler/permission_handler.dart'; - -import 'package:agora_rtc_engine/agora_rtc_engine.dart'; - -import '../../../../constant/api_key.dart'; -import '../../../../controller/functions/crud.dart'; - -String appId = AK.agoraAppId; - -class DriverCallPage extends StatefulWidget { - const DriverCallPage({super.key}); - - @override - State createState() => _DriverCallPageState(); -} - -class _DriverCallPageState extends State { - String channelName = ''; - String token = ''; - // "00612994c6e707543e68d5638894d04f989IAAlydoFEC3ZeZkeUwl0dSswZTX8n+xyZR8PBWdwXFV6t6MLiA8AAAAAEACCHD/gn3TUZQEAAQAAAAAA"; - - // int uid = int.parse(box.read(BoxName.phoneDriver)); // uid of the local user - int uid = 0; - int? _remoteUid; // uid of the remote user - bool _isJoined = false; // Indicates if the local user has joined the channel - late RtcEngine agoraEngine; // Agora engine instance - - final GlobalKey scaffoldMessengerKey = - GlobalKey(); // Global key to access the scaffold - - showMessage(String message) { - scaffoldMessengerKey.currentState?.showSnackBar(SnackBar( - content: Text(message), - )); - } - - initAgora() async { - await fetchToken(); - await setupVoiceSDKEngine(); - } - - fetchToken() async { - var res = await CRUD() - .getAgoraToken(channelName: channelName, uid: uid.toString()); - setState(() { - token = res; - print('token is $token'); - }); - } - - @override - void initState() { - super.initState(); - _remoteUid = box.read(BoxName.phone) != null - ? int.parse(box.read(BoxName.phone)) - : int.parse(box.read(BoxName.phoneDriver)); - uid = box.read(BoxName.phoneDriver) != null - ? int.parse(box.read(BoxName.phoneDriver)) - : int.parse(box.read(BoxName.phone)); - print('remoteid is $_remoteUid'); - print('uid is $uid'); - // Set up an instance of Agora engine - initAgora(); - } - - Future setupVoiceSDKEngine() async { - // retrieve or request microphone permission - await [Permission.microphone].request(); - - //create an instance of the Agora engine - agoraEngine = createAgoraRtcEngine(); - await agoraEngine.initialize(RtcEngineContext(appId: AK.agoraAppId)); - print('eeeeeeeeeeeeeeeeeeee'); - print(agoraEngine); - // Register the event handler - agoraEngine.registerEventHandler( - RtcEngineEventHandler( - onJoinChannelSuccess: (RtcConnection connection, int elapsed) { - showMessage( - "Local user uid:${connection.localUid} joined the channel"); - setState(() { - _isJoined = true; - }); - }, - onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) { - showMessage("Remote user uid:$remoteUid joined the channel"); - setState(() { - _remoteUid = remoteUid; - }); - }, - onUserOffline: (RtcConnection connection, int remoteUid, - UserOfflineReasonType reason) { - showMessage("Remote user uid:$remoteUid left the channel"); - setState(() { - _remoteUid = null; - }); - }, - ), - ); - } - - void join() async { - // Set channel options including the client role and channel profile - ChannelMediaOptions options = const ChannelMediaOptions( - clientRoleType: ClientRoleType.clientRoleBroadcaster, - channelProfile: ChannelProfileType.channelProfileCommunication, - ); - - await agoraEngine.joinChannel( - token: token, - channelId: channelName, - options: options, - uid: uid, - ); - } - //https://console.agora.io/invite?sign=5e9e22d06f22caeeada9954c9e908572%253A5ba8aed978a35eab5a5113742502ded2a41478b2a81cb19c71a30776e125b58a - - void leave() { - setState(() { - _isJoined = false; - _remoteUid = null; - }); - agoraEngine.leaveChannel(); - } - -// Clean up the resources when you leave - @override - void dispose() async { - await agoraEngine.leaveChannel(); - super.dispose(); - } - -// Build UI - @override - Widget build(BuildContext context) { - return MaterialApp( - scaffoldMessengerKey: scaffoldMessengerKey, - home: MyScafolld( - // appBar: AppBar( - // title: const Text('Get started with Voice Calling'), - // ), - title: 'Voice Calling'.tr, - isleading: true, - body: [ - ListView( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), - children: [ - // Status text - Container(height: 40, child: Center(child: _status())), - // Button Row - Row( - children: [ - Expanded( - child: ElevatedButton( - child: const Text("Join"), - onPressed: () => {join()}, - ), - ), - const SizedBox(width: 10), - Expanded( - child: ElevatedButton( - child: const Text("Leave"), - onPressed: () => {leave()}, - ), - ), - ], - ), - ], - ), - ]), - ); - } - - Widget _status() { - String statusText; - - if (!_isJoined) - statusText = 'Join a channel'; - else if (_remoteUid == null) - statusText = 'Waiting for a remote user to join...'; - else - statusText = 'Connected to remote user, uid:$_remoteUid'; - - return Text( - statusText, - ); - } -} diff --git a/lib/views/home/Captin/home_captain/help_captain.dart b/lib/views/home/Captin/home_captain/help_captain.dart deleted file mode 100644 index bf60bdd..0000000 --- a/lib/views/home/Captin/home_captain/help_captain.dart +++ /dev/null @@ -1,155 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/controller/home/captin/help/help_controller.dart'; -import 'package:SEFER/views/home/Captin/home_captain/help_details_replay_page.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; - -import '../../../widgets/elevated_btn.dart'; -import '../../../widgets/mycircular.dart'; - -class HelpCaptain extends StatelessWidget { - HelpCaptain({super.key}); - - @override - Widget build(BuildContext context) { - Get.put(HelpController()); - return MyScafolld( - title: 'Helping Page'.tr, - body: [ - Column( - children: [ - Card( - color: AppColor.yellowColor, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - 'If you need any help or have question this is right site to do that and your welcome' - .tr, - style: AppStyle.title, - ), - ), - ), - Card( - elevation: 3, - color: AppColor.secondaryColor, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: GetBuilder( - builder: (helpController) => Form( - key: helpController.formKey, - child: Column( - children: [ - SizedBox( - width: Get.width * .8, - child: TextFormField( - controller: - helpController.helpQuestionController, - decoration: InputDecoration( - border: const OutlineInputBorder(), - hintText: 'Enter your Question here'.tr, - labelText: 'Question'.tr, - ), - validator: (value) { - if (value == null || value.isEmpty) { - return 'Please enter your Question.'.tr; - } - return null; - }, - ), - ), - const SizedBox(height: 20), - helpController.isLoading - ? const MyCircularProgressIndicator() - : MyElevatedButton( - onPressed: () { - if (helpController.formKey.currentState! - .validate()) { - helpController.addHelpQuestion(); - - // Clear the feedback form - helpController.formKey.currentState! - .reset(); - } - }, - title: 'Submit Question'.tr, - ), - ], - )), - ), - )), - GetBuilder( - builder: (helpController) => Container( - height: 400, - decoration: AppStyle.boxDecoration, - child: ListView.builder( - itemCount: helpController.helpQuestionDate['message'] != - null - ? helpController.helpQuestionDate['message'].length - : 0, - itemBuilder: (BuildContext context, int index) { - // if (helpController.helpQuestionDate['message'] == - // null) { - // return const CircularProgressIndicator(); - // } - var list = - helpController.helpQuestionDate['message'][index]; - return Padding( - padding: const EdgeInsets.all(3), - child: Container( - decoration: BoxDecoration( - border: Border.all( - color: AppColor.greenColor, - width: 3, - ), - borderRadius: BorderRadius.circular(11)), - // elevation: 3, - // color: AppColor.greenColor, - child: GestureDetector( - onTap: () { - print(list['id']); - helpController.getindex( - list['id'], list['helpQuestion']); - helpController - .getHelpRepley(list['id'].toString()); - Get.to( - () => const HelpDetailsReplayPage(), - ); - }, - child: Padding( - padding: const EdgeInsets.all(2), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - SizedBox( - width: Get.width * .6, - child: Text( - list['helpQuestion'], - style: AppStyle.title, - ), - ), - SizedBox( - width: Get.width * .3, - child: Text( - list['datecreated'], - style: AppStyle.subtitle, - ), - ), - ], - ), - ), - ), - ), - ); - }, - ), - )), - ], - ), - ], - isleading: true, - ); - } -} diff --git a/lib/views/home/Captin/home_captain/help_details_replay_page.dart b/lib/views/home/Captin/home_captain/help_details_replay_page.dart deleted file mode 100644 index 4b31dd4..0000000 --- a/lib/views/home/Captin/home_captain/help_details_replay_page.dart +++ /dev/null @@ -1,82 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/views/widgets/mycircular.dart'; - -import '../../../../controller/home/captin/help/help_controller.dart'; -import '../../../widgets/my_scafold.dart'; - -class HelpDetailsReplayPage extends StatelessWidget { - const HelpDetailsReplayPage({super.key}); - - @override - Widget build(BuildContext context) { - Get.find(); - return GetBuilder( - builder: (helpController) => MyScafolld( - title: 'Help Details'.tr, - body: [ - helpController.isLoading - ? const MyCircularProgressIndicator() - : Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Card( - elevation: 3, - child: Container( - width: Get.width * .66, - color: Colors.transparent, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - helpController.qustion, - style: AppStyle.title, - ), - ), - ), - ), - ]), - ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Card( - elevation: 3, - child: Container( - color: Colors.transparent, - width: Get.width * .66, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: helpController.status == - 'not yet' || - helpController - .helpQuestionRepleyDate[ - 'message']['replay'] - .toString() == - 'not yet' - ? Text( - 'No Response yet.'.tr, - style: AppStyle.title, - ) - : Text( - helpController - .helpQuestionRepleyDate[ - 'message']['replay'] - .toString(), - style: AppStyle.title, - ), - ), - ), - ), - ]), - ], - ) - ], - isleading: true, - )); - } -} diff --git a/lib/views/home/Captin/home_captain/home_captin.dart b/lib/views/home/Captin/home_captain/home_captin.dart deleted file mode 100644 index 2735fd7..0000000 --- a/lib/views/home/Captin/home_captain/home_captin.dart +++ /dev/null @@ -1,298 +0,0 @@ -import 'package:SEFER/controller/payment/paymob.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:flutter_font_icons/flutter_font_icons.dart'; -import 'package:SEFER/views/home/Captin/home_captain/drawer_captain.dart'; -import 'package:SEFER/views/widgets/mycircular.dart'; - -import '../../../../constant/colors.dart'; -import '../../../../constant/info.dart'; -import '../../../../constant/style.dart'; -import '../../../../constant/table_names.dart'; -import '../../../../controller/functions/location_controller.dart'; -import '../../../../controller/home/captin/home_captain_controller.dart'; -import '../../../../controller/home/captin/order_request_controller.dart'; -import 'widget/connect.dart'; -import 'widget/left_menu_map_captain.dart'; -import '../../../../controller/home/payment/captain_wallet_controller.dart'; -import '../../../../main.dart'; -import '../../../widgets/circle_container.dart'; - -class HomeCaptain extends StatelessWidget { - HomeCaptain({super.key}); - final LocationController locationController = Get.put(LocationController()); - final HomeCaptainController homeCaptainController = - Get.put(HomeCaptainController()); - @override - Widget build(BuildContext context) { - Get.put(OrderRequestController()); - Get.put(HomeCaptainController()); - return Scaffold( - appBar: AppBar( - backgroundColor: AppColor.greenColor, - elevation: 0, - title: Text('Home'.tr), - actions: [ - GetBuilder( - builder: (locationController) => locationController.isLoading - ? const SizedBox( - height: 1, - width: 1, - child: CircularProgressIndicator.adaptive()) - : const SizedBox(), - ), - IconButton( - // onPressed: () => box.remove(BoxName.periods), - onPressed: () => sql.deleteAllData(TableName.driverOrdersRefuse), - icon: const Icon(Icons.remove)), - GetBuilder( - builder: (orderRequestController) => IconButton( - onPressed: () => - orderRequestController.getRefusedOrderByCaptain(), - icon: const Icon(Icons.get_app)), - ), - IconButton( - onPressed: () { - PaymobManager().getPaymentKey(100, 'EGP'); - }, - icon: const Icon( - Icons.call, - size: 29, - ), - ), - ], - ), - drawer: DrawerCaptain(), - body: Stack( - children: [ - GetBuilder( - builder: (controller) => controller.isLoading - ? const MyCircularProgressIndicator() - : GoogleMap( - onMapCreated: controller.onMapCreated, - // cameraTargetBounds: CameraTargetBounds(controller.boundsdata), - minMaxZoomPreference: const MinMaxZoomPreference(6, 18), - - initialCameraPosition: CameraPosition( - target: locationController.myLocation, - zoom: 15, - ), - - mapType: - controller.mapType ? MapType.satellite : MapType.normal, - myLocationButtonEnabled: true, - // liteModeEnabled: true, tiltGesturesEnabled: false, - - // indoorViewEnabled: true, - trafficEnabled: controller.mapTrafficON, - buildingsEnabled: true, - mapToolbarEnabled: true, - - myLocationEnabled: true, - // liteModeEnabled: true, - ), - ), - Positioned( - bottom: 10, - right: Get.width * .1, - left: Get.width * .1, - child: const ConnectWidget()), - Positioned( - top: 5, - right: Get.width * .05, - left: Get.width * .05, - child: GetBuilder( - builder: (homeCaptainController) => Container( - decoration: AppStyle.boxDecoration, - width: Get.width * .8, - height: 104, - child: Center( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Icon( - Entypo.wallet, - color: AppColor.greenColor, - ), - Text( - ' You Earn today is '.tr + - homeCaptainController.totalMoneyToday, - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Icon( - Entypo.wallet, - color: AppColor.yellowColor, - ), - Text( - '${' You Have in'.tr} ${AppInformation.appName} is ${homeCaptainController.totalMoneyInSEFER} ', - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Text( - 'Total points is '.tr + - Get.find().totalPoints, - style: AppStyle.title, - ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6), - color: int.parse(Get.find() - .countRideToday) < - 5 - ? AppColor.accentColor - : int.parse(Get.find() - .countRideToday) > - 5 && - int.parse(Get.find< - HomeCaptainController>() - .countRideToday) < - 10 - ? AppColor.yellowColor - : AppColor.greenColor, - ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8, vertical: 2), - child: Text( - 'Ride Today : '.tr + - Get.find() - .countRideToday, - style: AppStyle.title - .copyWith(color: AppColor.secondaryColor), - ), - ), - ), - ], - ), - ], - ))), - ), - ), - Positioned( - bottom: 65, - right: Get.width * .1, - left: Get.width * .1, - child: GetBuilder( - builder: (homeCaptainController) => Container( - decoration: AppStyle.boxDecoration, - child: Column( - children: [ - Text( - '${'Active Duration:'.tr} ${homeCaptainController.stringActiveDuration} ', - style: AppStyle.title, - ), - Text( - '${'Total Connection Duration:'.tr} ${homeCaptainController.totalDurationToday} ', - style: AppStyle.title, - ), - ], - ), - ), - ), - ), - // Positioned( - // bottom: Get.height * .17, - // right: Get.width * .01, - // child: AnimatedContainer( - // duration: const Duration(microseconds: 200), - // width: Get.width * .12, - // decoration: BoxDecoration( - // color: AppColor.secondaryColor, - // border: Border.all(), - // borderRadius: BorderRadius.circular(15)), - // child: IconButton( - // onPressed: () async { - // CRUD().sendEmail(AppLink.sendEmailToPassengerForTripDetails, { - // 'startLocation': Get.find() - // .passengerLocation - // .toString(), - // 'endLocation': Get.find() - // .passengerDestination - // .toString(), - // 'name': Get.find().name.toString(), - // 'timeOfTrip': - // Get.find().timeOfOrder.toString(), - // 'fee': Get.find() - // .totalPassenger - // .toString(), - // 'duration': - // Get.find().duration.toString(), - // 'phone': Get.find().phone.toString(), - // 'email': Get.find().email.toString(), - // }); - // }, - // icon: const Icon( - // MaterialCommunityIcons.map_marker_radius, - // size: 45, - // color: AppColor.blueColor, - // ), - // ), - // ), - // ), - leftMainMenuCaptainIcons(), - // callPage(), - - // Positioned( - // top: Get.height * .2, - // // left: 20, - // // right: 20, - // bottom: Get.height * .4, - // child: IconButton( - // onPressed: () { - // homeCaptainController.getCountRideToday(); - // }, - // icon: const Icon(Icons.call), - // ), - // ), - ], - ), - ); - } -} - -// class CameraContainer extends StatelessWidget { -// TextMLGoogleRecognizerController controller = -// Get.put(TextMLGoogleRecognizerController()); - -// CameraContainer({super.key}); -// @override -// Widget build(BuildContext context) { -// return Stack( -// children: [ -// // The camera preview -// SizedBox( -// height: Get.height * 0.3, -// width: Get.width * 0.9, -// child: CameraPreview(controller.imagePicker as CameraController), -// ), - -// // The lines on the side of the name and national number -// const Positioned( -// bottom: 0, -// left: 0, -// right: 0, -// child: Column( -// children: [ -// Text('Name'), -// Text('National Number'), -// ], -// ), -// ), -// ], -// ); -// } -// } diff --git a/lib/views/home/Captin/home_captain/widget/call_page.dart b/lib/views/home/Captin/home_captain/widget/call_page.dart deleted file mode 100644 index 379897e..0000000 --- a/lib/views/home/Captin/home_captain/widget/call_page.dart +++ /dev/null @@ -1,98 +0,0 @@ -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/controller/firebase/firbase_messge.dart'; -import 'package:SEFER/controller/home/captin/map_driver_controller.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/controller/home/captin/home_captain_controller.dart'; - -import '../../../../../constant/box_name.dart'; -import '../../../../../controller/functions/call_controller.dart'; -import '../../../../../main.dart'; - -class CallPage extends StatelessWidget { - const CallPage({super.key}); - - @override - Widget build(BuildContext context) { - return MyScafolld(title: 'Call Page', isleading: true, body: [callPage()]); - } -} - -GetBuilder callPage() { - CallController callController = Get.put(CallController()); - Get.put(MapDriverController()); - callController.initAgoraFull(); - return GetBuilder( - builder: (controller) => Positioned( - top: Get.height * .2, - child: Container( - height: 100, width: Get.width, - decoration: AppStyle.boxDecoration, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - GestureDetector( - onTap: () async { - // await callController.initAgoraFull(); - // callController.join(); - FirebaseMessagesController().sendNotificationToPassengerToken( - 'Call Income', - 'You have call from driver ${box.read(BoxName.nameDriver)}', - Get.find().tokenPassenger, - [ - callController.token, - callController.channelName, - callController.uid.toString(), - callController.remoteUid.toString(), - ], - ); - callController.join(); - }, - child: Container( - width: 50, - height: 50, - decoration: const BoxDecoration( - shape: BoxShape.circle, color: AppColor.greenColor), - child: const Icon( - Icons.phone, - size: 35, - color: AppColor.secondaryColor, - )), - ), - Column( - children: [ - Text(callController.status), - Text(Get.find().passengerName.toString()), - ], - ), - GestureDetector( - onTap: () async { - FirebaseMessagesController().sendNotificationToPassengerToken( - 'Call End'.tr, - 'Call End', - Get.find().tokenPassenger, - [], - ); - callController.leave(); - Get.back(); - }, - child: Container( - width: 50, - height: 50, - decoration: const BoxDecoration( - shape: BoxShape.circle, color: AppColor.redColor), - child: const Icon( - Icons.phone_disabled_sharp, - size: 35, - color: AppColor.secondaryColor, - )), - ) - ], - ), - // ignore: prefer_const_constructors - ), - ), - ); -} diff --git a/lib/views/home/Captin/home_captain/widget/call_page_From_passenger.dart b/lib/views/home/Captin/home_captain/widget/call_page_From_passenger.dart deleted file mode 100644 index 1d18154..0000000 --- a/lib/views/home/Captin/home_captain/widget/call_page_From_passenger.dart +++ /dev/null @@ -1,116 +0,0 @@ -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/controller/firebase/firbase_messge.dart'; -import 'package:SEFER/controller/home/map_passenger_controller.dart'; -import 'package:SEFER/controller/functions/call_controller.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/controller/home/captin/home_captain_controller.dart'; - -class CallPageFromPassenger extends StatelessWidget { - const CallPageFromPassenger({super.key}); - - @override - Widget build(BuildContext context) { - return MyScafolld( - title: 'Call Page'.tr, isleading: true, body: [callPage()]); - } -} - -GetBuilder callPage() { - CallController callController = Get.put(CallController()); - // callController.initAgoraFull(); - return GetBuilder( - builder: (controller) => Column( - children: [ - Padding( - padding: const EdgeInsets.all(15), - child: Container( - decoration: AppStyle.boxDecoration1, - child: Text( - 'No SIM card, no problem! Call your driver directly through our app. We use advanced technology to ensure your privacy.' - .tr, - style: AppStyle.title, - ), - ), - ), - const SizedBox( - height: 30, - ), - Padding( - padding: const EdgeInsets.all(15), - child: Container( - height: 100, width: Get.width, - decoration: AppStyle.boxDecoration, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - GestureDetector( - onTap: () async { - // await callController.initAgoraFull(); - // callController.join(); - // FirebaseMessagesController().sendNotificationToPassengerToken( - // 'Call Income', - // 'You have call from driver ${box.read(BoxName.nameDriver)}', - // Get.find().tokenPassenger, - // [ - // callController.token, - // callController.channelName, - // callController.uid.toString(), - // callController.remoteUid.toString(), - // ], - // ); - callController.join(); - }, - child: Container( - width: 50, - height: 50, - decoration: const BoxDecoration( - shape: BoxShape.circle, color: AppColor.greenColor), - child: const Icon( - Icons.phone, - size: 35, - color: AppColor.secondaryColor, - )), - ), - Column( - children: [ - Text(callController.status), - Text(Get.find() - .driverName - .toString()), - ], - ), - GestureDetector( - onTap: () async { - FirebaseMessagesController() - .sendNotificationToPassengerToken( - 'Call End', - 'Call End'.tr, - Get.find().driverToken, - [], - ); - callController.leave(); - Get.back(); - }, - child: Container( - width: 50, - height: 50, - decoration: const BoxDecoration( - shape: BoxShape.circle, color: AppColor.redColor), - child: const Icon( - Icons.phone_disabled_sharp, - size: 35, - color: AppColor.secondaryColor, - )), - ) - ], - ), - // ignore: prefer_const_constructors - ), - ), - ], - ), - ); -} diff --git a/lib/views/home/Captin/home_captain/widget/connect.dart b/lib/views/home/Captin/home_captain/widget/connect.dart deleted file mode 100644 index 66d997c..0000000 --- a/lib/views/home/Captin/home_captain/widget/connect.dart +++ /dev/null @@ -1,103 +0,0 @@ -import 'package:SEFER/controller/functions/tts.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/controller/home/payment/captain_wallet_controller.dart'; - -import '../../../../../constant/style.dart'; -import '../../../../widgets/elevated_btn.dart'; -import '../../../../../controller/home/captin/home_captain_controller.dart'; -import '../../../../../controller/home/captin/order_request_controller.dart'; - -class ConnectWidget extends StatelessWidget { - const ConnectWidget({ - super.key, - }); - - @override - Widget build(BuildContext context) { - final OrderRequestController orderRequestController = - Get.put(OrderRequestController()); - CaptainWalletController captainWalletController = - Get.put(CaptainWalletController()); - - captainWalletController.getCaptainWalletFromBuyPoints(); - return Center( - child: GetBuilder( - builder: (homeCaptainController) => int.parse( - orderRequestController.countRefuse) > - 3 || - double.parse(captainWalletController.totalPoints) < -300 - ? CupertinoButton( - onPressed: () { - Get.defaultDialog( - // backgroundColor: CupertinoColors.destructiveRed, - barrierDismissible: false, - title: double.parse(captainWalletController.totalPoints) < - -300 - ? 'You dont have Points'.tr - : 'You Are Stopped For this Day !'.tr, - titleStyle: AppStyle.title, - content: Column( - children: [ - IconButton( - onPressed: () async { - double.parse( - captainWalletController.totalPoints) < - -300 - ? await Get.find() - .speakText( - 'You must be recharge your Account' - .tr) - : await Get.find() - .speakText( - 'You Refused 3 Rides this Day that is the reason \nSee you Tomorrow!' - .tr); - }, - icon: const Icon(Icons.headphones), - ), - Text( - double.parse(captainWalletController.totalPoints) < - -300 - ? 'You must be recharge your Account'.tr - : 'You Refused 3 Rides this Day that is the reason \nSee you Tomorrow!' - .tr, - style: AppStyle.title, - ), - ], - ), - confirm: - double.parse(captainWalletController.totalPoints) < - -300 - ? MyElevatedButton( - title: 'Recharge my Account'.tr, - onPressed: () { - homeCaptainController - .goToWalletFromConnect(); - }) - : MyElevatedButton( - title: 'Ok , See you Tomorrow'.tr, - onPressed: () { - Get.back(); - Get.back(); - })); - }, - color: CupertinoColors.destructiveRed, - child: Text( - 'You are Stopped'.tr, - style: AppStyle.title, - ), - ) - : CupertinoButton( - onPressed: homeCaptainController.onButtonSelected, - color: homeCaptainController.isActive - ? CupertinoColors.activeGreen - : CupertinoColors.inactiveGray, - child: Text(homeCaptainController.isActive - ? 'Connected'.tr - : 'Not Connected'.tr), - ), - ), - ); - } -} diff --git a/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart b/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart deleted file mode 100644 index ad5a3b3..0000000 --- a/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart +++ /dev/null @@ -1,137 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_font_icons/flutter_font_icons.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/controller/home/captin/home_captain_controller.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; - -import '../../../../../constant/colors.dart'; -import '../../../../Rate/ride_calculate_driver.dart'; -import '../../../../../controller/functions/location_controller.dart'; - -GetBuilder leftMainMenuCaptainIcons() { - return GetBuilder( - builder: (controller) => Positioned( - bottom: Get.height * .17, - left: 6, - child: Column( - children: [ - AnimatedContainer( - duration: const Duration(microseconds: 200), - width: controller.widthMapTypeAndTraffic, - decoration: BoxDecoration( - border: Border.all(), - color: AppColor.secondaryColor, - borderRadius: BorderRadius.circular(15)), - child: IconButton( - onPressed: () { - // AudioController audio = Get.put(AudioController()); - // audio.startRecording(); - // AC credentials = AC(); - // String apiKey = ''; - // String convertedStringN = credentials.c( - // credentials.c(credentials.c(apiKey, cs), cC), cn); - // print('Converted v: $convertedStringN'); - // - // String retrievedStringS = credentials.r( - // credentials.r(credentials.r(convertedStringN, cn), cC), - // cs); - // print('Retrieved String: $retrievedStringS'); - // // - // if (retrievedStringS == apiKey) { - // print('same'); - // } - // Get.to((OrderRequestPage())); - // ZonesController mapDriverController = - // Get.put(ZonesController()); - // mapDriverController.getJsonOfZones(); - }, - icon: const Icon( - FontAwesome.map_signs, - size: 24, - color: Colors.black, - )), - ), - const SizedBox( - height: 5, - ), - AnimatedContainer( - duration: const Duration(microseconds: 200), - width: controller.widthMapTypeAndTraffic, - decoration: BoxDecoration( - border: Border.all(), - color: AppColor.secondaryColor, - borderRadius: BorderRadius.circular(15)), - child: IconButton( - onPressed: () { - controller.changeMapType(); - // Toast.show(context, 'This is a toast message!'); - }, - icon: const Icon( - Icons.satellite_alt, - size: 29, - ), - ), - ), - const SizedBox( - height: 5, - ), - AnimatedContainer( - duration: const Duration(microseconds: 200), - width: controller.widthMapTypeAndTraffic, - decoration: BoxDecoration( - color: AppColor.secondaryColor, - border: Border.all(), - borderRadius: BorderRadius.circular(15)), - child: IconButton( - onPressed: () { - controller.changeMapTraffic(); - // Toast.show(context, 'This is a toast message!'); - }, - icon: const Icon( - Icons.streetview_sharp, - size: 29, - ), - ), - ), - const SizedBox( - height: 5, - ), - AnimatedContainer( - duration: const Duration(microseconds: 200), - width: controller.widthMapTypeAndTraffic, - decoration: BoxDecoration( - color: AppColor.secondaryColor, - border: Border.all(), - borderRadius: BorderRadius.circular(15)), - child: IconButton( - onPressed: () { - controller.mapHomeCaptainController - .animateCamera(CameraUpdate.newLatLng(LatLng( - Get.find().myLocation.latitude, - Get.find().myLocation.longitude, - ))); - }, - icon: const Icon( - Icons.location_on, - size: 29, - ), - ), - ), - AnimatedContainer( - duration: const Duration(microseconds: 200), - width: controller.widthMapTypeAndTraffic, - decoration: BoxDecoration( - color: AppColor.secondaryColor, - border: Border.all(), - borderRadius: BorderRadius.circular(15)), - child: IconButton( - onPressed: () { - Get.to(() => RideCalculateDriver()); - }, - icon: const Icon(FontAwesome5.chart_bar), - ), - ), - ], - )), - ); -} diff --git a/lib/views/home/Captin/home_captain/widget/zones_controller.dart b/lib/views/home/Captin/home_captain/widget/zones_controller.dart deleted file mode 100644 index 0278e91..0000000 --- a/lib/views/home/Captin/home_captain/widget/zones_controller.dart +++ /dev/null @@ -1,73 +0,0 @@ -import 'dart:convert'; -import 'dart:math'; - -import 'package:get/get.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; - -class ZonesController extends GetxController { - Map> generateZoneMap( - LatLng southwest, LatLng southEast, LatLng northeast) { - const double desiredZoneArea = 4; // in square kilometers - - final double width = (southEast.longitude - southwest.longitude) * 100; - final double height = (northeast.latitude - southEast.latitude) * 100; - final double totalArea = width * height; - print(width); - print(height); - - // final int numZones = (totalArea / desiredZoneArea).ceil(); - - final double zoneWidth = width / sqrt(desiredZoneArea); - final double zoneHeight = height / sqrt(desiredZoneArea); - final numRows = - ((northeast.latitude - southwest.latitude) / zoneHeight).ceil(); - final numCols = - ((southEast.longitude - southwest.longitude) / zoneWidth).ceil(); - print('zoneWidth = $zoneWidth'); - print('zoneHeight = $zoneHeight'); - List zoneNames = []; - List zoneCoordinates = []; - - for (int row = 0; row < numRows; row++) { - for (int col = 0; col < numCols; col++) { - final double zoneSouthwestLat = - southwest.latitude + (row * zoneHeight / 100); - final double zoneSouthwestLng = - southwest.longitude + (col * zoneWidth / 100); - final double zoneNortheastLat = zoneSouthwestLat + zoneHeight / 100; - final double zoneNortheastLng = zoneSouthwestLng + zoneWidth / 100; - - LatLng zoneSouthwest = LatLng(zoneSouthwestLat, zoneSouthwestLng); - LatLng zoneNortheast = LatLng(zoneNortheastLat, zoneNortheastLng); - - String zoneName = - 'Zone${row + col}'; // Assign a unique name to each zone - - zoneNames.add(zoneName); - zoneCoordinates.add(zoneSouthwest); - zoneCoordinates.add(zoneNortheast); - } - } - - Map> zoneMap = {}; - for (int i = 0; i < zoneNames.length; i++) { - zoneMap[zoneNames[i]] = [ - zoneCoordinates[i], // Southwest LatLng - zoneCoordinates[i + 1], // Northeast LatLng - ]; - } - - return zoneMap; - } - - void getJsonOfZones() { - LatLng southwest = const LatLng(32.111107, 36.062222); - LatLng southEast = const LatLng(32.108333, 36.101667); - LatLng northeast = const LatLng(32.143889, 36.058889); - Map> zoneMap = - generateZoneMap(southwest, southEast, northeast); - String jsonMap = json.encode(zoneMap); - - print(jsonMap); - } -} diff --git a/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart b/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart deleted file mode 100644 index d287e9e..0000000 --- a/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart +++ /dev/null @@ -1,255 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:get/get.dart'; -import 'package:vibration/vibration.dart'; - -import '../../../../constant/colors.dart'; -import '../../../../constant/style.dart'; -import '../../../../controller/home/captin/home_captain_controller.dart'; -import '../../../../controller/home/captin/map_driver_controller.dart'; -import '../../../widgets/elevated_btn.dart'; - -GetBuilder driverEndRideBar() { - return GetBuilder( - builder: (mapDriverController) => mapDriverController.isRideStarted - ? Positioned( - left: 5, - top: 5, - right: 5, - child: Container( - decoration: AppStyle.boxDecoration1, - height: mapDriverController.remainingTimeTimerRideBegin < 60 - ? mapDriverController.driverEndPage = 190 - : mapDriverController.carType == 'Mashwari' - ? 120 - : 170, - // width: 240, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - mapDriverController.carType != 'Mashwari' - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Column( - children: [ - const Icon(Icons.social_distance), - Text( - '${mapDriverController.distance} ${'KM'.tr}', - style: AppStyle.title, - ), - ], - ), - Column( - children: [ - const Icon(Icons.timelapse), - Text( - mapDriverController.hours > 1 - ? '${'${'Your Ride Duration is '.tr}${mapDriverController.hours}${' H and'.tr}'} ${mapDriverController.minutes} m' - : '${'Your Ride Duration is '.tr} ${mapDriverController.minutes} ${'m'.tr}', - style: AppStyle.title), - ], - ), - Column( - children: [ - const Icon(Icons.money_sharp), - Text( - '${mapDriverController.paymentAmount} ${'\$'.tr}', - style: AppStyle.title), - ], - ), - ], - ) - : const SizedBox(), - mapDriverController.carType != 'Speed' && - mapDriverController.carType != 'Delivery' - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Container( - width: Get.width * .2, - decoration: AppStyle.boxDecoration1, - child: Padding( - padding: const EdgeInsets.all(4), - child: Row( - children: [ - const Icon(Icons.timer), - Text( - mapDriverController - .stringRemainingTimeRideBegin1, - style: AppStyle.number, - ), - ], - ), - )), - Container( - width: Get.width * .2, - decoration: AppStyle.boxDecoration1, - child: Padding( - padding: const EdgeInsets.all(4), - child: Row( - children: [ - const Icon(Icons.location_on), - Text( - '${mapDriverController.recentDistanceToDash.toStringAsFixed(0)} ${'KM'.tr}', - style: AppStyle.number, - ), - ], - ), - ), - ), - Container( - width: Get.width * .2, - decoration: AppStyle.boxDecoration1, - child: Padding( - padding: const EdgeInsets.all(4.0), - child: Row( - children: [ - const Icon(Icons.attach_money), - Text( - mapDriverController.price - .toStringAsFixed(2), - style: AppStyle.number, - ), - ], - ), - ), - ), - ], - ) - : const SizedBox(), - (mapDriverController.carType == 'Mashwari' || - mapDriverController.carType == 'Comfort') && - mapDriverController.remainingTimeTimerRideBegin > 60 - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - MyElevatedButton( - title: 'End Ride'.tr, - onPressed: () { - mapDriverController.finishRideFromDriver(); - }, - kolor: AppColor.redColor, - ), - Container( - decoration: AppStyle.boxDecoration1, - child: InkWell( - onTap: () { - print(Get.find() - .comfortPrice); - }, - child: Text( - mapDriverController.carType, - style: AppStyle.title, - ), - ), - ) - ], - ) - : const SizedBox(), - mapDriverController.remainingTimeTimerRideBegin < 60 - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - MyElevatedButton( - title: 'End Ride'.tr, - onPressed: () { - mapDriverController.finishRideFromDriver(); - }, - kolor: AppColor.redColor, - ), - Container( - decoration: AppStyle.boxDecoration1, - child: Text( - mapDriverController.carType, - style: AppStyle.title, - ), - ) - ], - ) - : const SizedBox(), - mapDriverController.carType != 'Comfort' && - mapDriverController.carType != 'Mashwari' - ? Stack( - children: [ - SizedBox( - width: Get.width * .9, - child: LinearProgressIndicator( - backgroundColor: AppColor.accentColor, - color: mapDriverController - .remainingTimeTimerRideBegin < - 60 - ? AppColor.redColor - : AppColor.greenColor, - minHeight: 25, - borderRadius: BorderRadius.circular(6), - value: mapDriverController - .progressTimerRideBegin - .toDouble(), - ), - ), - Center( - child: Text( - mapDriverController - .stringRemainingTimeRideBegin, - style: AppStyle.title, - ), - ) - ], - ) - : const SizedBox(), - ], - ), - )) - : const SizedBox()); -} - -GetBuilder speedCircle() { - if (Get.find().speed > 100) { - if (Platform.isIOS) { - HapticFeedback.selectionClick(); - } else { - Vibration.vibrate(duration: 1000); - } - Get.defaultDialog( - barrierDismissible: false, - titleStyle: AppStyle.title, - title: 'Speed Over'.tr, - middleText: 'Please slow down'.tr, - middleTextStyle: AppStyle.title, - confirm: MyElevatedButton( - title: 'I will slow down'.tr, - onPressed: () => Get.back(), - ), - ); - } - return GetBuilder( - builder: (mapDriverController) { - return mapDriverController.isRideStarted - ? Positioned( - bottom: 25, - right: 100, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - color: mapDriverController.speed > 100 - ? Colors.red - : AppColor.secondaryColor, - border: Border.all(width: 3, color: AppColor.redColor), - ), - height: 60, - width: 60, - child: Center( - child: Text( - mapDriverController.speed.toStringAsFixed(0), - style: AppStyle.number, - ), - ), - ), - ) - : const SizedBox(); - }, - ); -} diff --git a/lib/views/home/Captin/mapDriverWidgets/google_driver_map_page.dart b/lib/views/home/Captin/mapDriverWidgets/google_driver_map_page.dart deleted file mode 100644 index 45a0300..0000000 --- a/lib/views/home/Captin/mapDriverWidgets/google_driver_map_page.dart +++ /dev/null @@ -1,97 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; - -import '../../../../constant/colors.dart'; -import '../../../../controller/functions/location_controller.dart'; -import '../../../../controller/home/captin/map_driver_controller.dart'; - -class GoogleDriverMap extends StatelessWidget { - const GoogleDriverMap({ - super.key, - required this.locationController, - }); - - final LocationController locationController; - - @override - Widget build(BuildContext context) { - // Get.put(MapDriverController()); - return Padding( - padding: const EdgeInsets.all(8.0), - child: GetBuilder( - builder: (controller) => GoogleMap( - onMapCreated: controller.onMapCreated, - initialCameraPosition: CameraPosition( - // bearing: 45, - target: locationController.myLocation, - zoom: 16, - tilt: 40, - ), - onCameraMoveStarted: () {}, - onCameraMove: (position) { - locationController.myLocation = position.target; - controller.mapController! - .animateCamera(CameraUpdate.newCameraPosition(position)); - }, - minMaxZoomPreference: const MinMaxZoomPreference(6, 18), - myLocationEnabled: true, - compassEnabled: true, - mapType: MapType.normal, - trafficEnabled: true, - buildingsEnabled: true, - mapToolbarEnabled: true, - zoomControlsEnabled: true, - fortyFiveDegreeImageryEnabled: true, - zoomGesturesEnabled: true, - polylines: { - Polyline( - zIndex: 2, - consumeTapEvents: true, - geodesic: true, - endCap: Cap.buttCap, - startCap: Cap.buttCap, - visible: true, - polylineId: const PolylineId('route1'), - points: controller.polylineCoordinates, - color: AppColor.greenColor, - width: 3, - ), - Polyline( - zIndex: 2, - consumeTapEvents: true, - geodesic: true, - endCap: Cap.buttCap, - startCap: Cap.buttCap, - visible: true, - polylineId: const PolylineId('route'), - points: controller.polylineCoordinatesDestination, - color: AppColor.primaryColor, - width: 2, - ), - }, - markers: { - Marker( - markerId: MarkerId('MyLocation'.tr), - position: locationController.myLocation, - draggable: true, - icon: controller.carIcon, - rotation: locationController.heading), - Marker( - markerId: MarkerId('start'.tr), - position: controller.latLngpassengerLocation, - draggable: true, - icon: controller.startIcon, - ), - Marker( - markerId: MarkerId('end'.tr), - position: controller.latLngPassengerDestination, - draggable: true, - icon: controller.endIcon, - ), - }, - ), - ), - ); - } -} diff --git a/lib/views/home/Captin/mapDriverWidgets/google_map_app.dart b/lib/views/home/Captin/mapDriverWidgets/google_map_app.dart deleted file mode 100644 index 156e589..0000000 --- a/lib/views/home/Captin/mapDriverWidgets/google_map_app.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/controller/home/captin/map_driver_controller.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_font_icons/flutter_font_icons.dart'; -import 'package:get/get.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class GoogleMapApp extends StatelessWidget { - const GoogleMapApp({super.key}); - - @override - Widget build(BuildContext context) { - return GetBuilder( - builder: (mapDriverController) => mapDriverController.isRideStarted - ? Positioned( - left: 125, - bottom: 20, - child: Container( - decoration: AppStyle.boxDecoration, - child: IconButton( - onPressed: () async { - var startLat = Get.find() - .latLngpassengerLocation - .latitude; - var startLng = Get.find() - .latLngpassengerLocation - .longitude; - - var endLat = Get.find() - .latLngPassengerDestination - .latitude; - var endLng = Get.find() - .latLngPassengerDestination - .longitude; - - String url = - 'https://www.google.com/maps/dir/$startLat,$startLng/$endLat,$endLng/&directionsmode=driving'; - if (await canLaunchUrl(Uri.parse(url))) { - await launchUrl(Uri.parse(url)); - } else { - throw 'Could not launch google maps'; - } - }, - icon: const Icon( - MaterialCommunityIcons.map_marker_radius, - size: 45, - color: AppColor.blueColor, - ), - )), - ) - : const SizedBox()); - } -} diff --git a/lib/views/home/Captin/mapDriverWidgets/passenger_info_window.dart b/lib/views/home/Captin/mapDriverWidgets/passenger_info_window.dart deleted file mode 100644 index 185a196..0000000 --- a/lib/views/home/Captin/mapDriverWidgets/passenger_info_window.dart +++ /dev/null @@ -1,421 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; -import 'package:flutter_font_icons/flutter_font_icons.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/box_name.dart'; -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/info.dart'; -import 'package:SEFER/controller/firebase/firbase_messge.dart'; -import 'package:SEFER/controller/home/captin/map_driver_controller.dart'; -import 'package:SEFER/main.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; - -import '../../../../constant/style.dart'; -import '../../../../controller/functions/launch.dart'; -import '../home_captain/widget/call_page.dart'; - -class PassengerInfoWindow extends StatelessWidget { - const PassengerInfoWindow({ - super.key, - }); - - @override - Widget build(BuildContext context) { - Get.put(MapDriverController()); - return GetBuilder( - builder: (controller) => controller.isPassengerInfoWindow == true - ? Stack( - children: [ - Positioned( - bottom: 5, - // left: 8, - child: AnimatedContainer( - duration: const Duration(milliseconds: 300), - height: controller.passengerInfoWindowHeight, - width: Get.width, - decoration: AppStyle.boxDecoration1, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - DefaultTextStyle( - style: AppStyle.title, - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Go to passenger Location now'.tr, - style: AppStyle.title - .copyWith(color: AppColor.greenColor), - ), - controller.isRideBegin - ? const SizedBox() - : Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - GestureDetector( - onTap: () async { - controller.isSocialPressed = - true; - await controller - .driverCallPassenger(); // to check from scam - Get.to( - () => const CallPage()); - // launchCommunication('phone', - // controller.phone.toString(), ''); - }, - child: const Icon( - Icons.phone, - color: AppColor.blueColor, - )), - const SizedBox( - width: 25, - ), - GestureDetector( - onTap: () { - controller.isSocialPressed = - true; - launchCommunication( - 'email', - controller.passengerPhone - .toString(), - '${'Hello this is Driver'.tr} ${box.read(BoxName.nameDriver)}'); - }, - child: const Icon( - Icons.email, - color: AppColor.redColor, - )), - const SizedBox( - width: 25, - ), - Container( - decoration: - AppStyle.boxDecoration, - child: IconButton( - onPressed: () async { - await controller - .openGoogleMapFromDriverToPassenger(); - }, - icon: const Icon( - MaterialCommunityIcons - .map_marker_radius, - size: 35, - color: AppColor.blueColor, - ), - )), - ], - ), - ], - )), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - decoration: AppStyle.boxDecoration1, - width: Get.width * .22, - child: Padding( - padding: const EdgeInsets.all(4.0), - child: Text( - controller.hours > 1 - ? '⌚️ ${controller.hours}h ${controller.minutes}m' // Ride Duration with emoji - : '⌚️ ${controller.minutes}m', // Short ride duration - style: AppStyle.title, - ), - ), - ), - const SizedBox( - width: 16.0), // Add spacing between sections - Container( - decoration: AppStyle.boxDecoration1, - width: Get.width * .22, - child: Padding( - padding: const EdgeInsets.all(4), - child: Text( - ' ${controller.distance} km', // Distance with emoji - style: AppStyle.title, - ), - ), - ), - const SizedBox( - width: 16.0), // Add spacing between sections - Container( - decoration: AppStyle.boxDecoration1, - width: Get.width * .35, - child: Padding( - padding: const EdgeInsets.all(4.0), - child: Text( - controller - .passengerName, // Passenger name with emoji - style: AppStyle.title, - ), - ), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Container( - decoration: AppStyle.boxDecoration1, - width: Get.width * .4, - child: Padding( - padding: const EdgeInsets.all(4), - child: Row( - children: [ - Text('Total Cost is '.tr, - style: AppStyle.title), - Text( - controller.totalPassenger.toString(), - style: AppStyle.title, - ), - ], - ), - ), - ), - Container( - decoration: AppStyle.boxDecoration1, - width: Get.width * .4, - child: Padding( - padding: const EdgeInsets.all(4), - child: Text(controller.carType, - style: AppStyle.title), - ), - ), - ], - ), - controller.remainingTimeToPassenger != 0 - ? Stack( - children: [ - LinearProgressIndicator( - backgroundColor: AppColor.accentColor, - color: - controller.remainingTimeToPassenger < - 60 - ? AppColor.redColor - : AppColor.greenColor, - minHeight: 35, - borderRadius: BorderRadius.circular(15), - value: controller.progressToPassenger - .toDouble(), - ), - Center( - child: Text( - controller - .stringRemainingTimeToPassenger, - style: AppStyle.title, - ), - ) - ], - ) - : controller.isRideBegin - ? const SizedBox() - : Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - MyElevatedButton( - title: 'Start the Ride'.tr, - kolor: AppColor.greenColor, - onPressed: () { - Get.defaultDialog( - title: - 'Is the Passenger in your Car ?' - .tr, - titleStyle: - AppStyle.title, - middleText: - 'don\'t start trip if not ' - .tr, - middleTextStyle: - AppStyle.title, - confirm: MyElevatedButton( - title: 'OK'.tr, - kolor: AppColor - .greenColor, - onPressed: () async { - await controller - .startRideFromDriver(); - Get.back(); - }), - cancel: MyElevatedButton( - title: - 'No ,still Waiting.' - .tr, - kolor: - AppColor.redColor, - onPressed: () { - Get.back(); - })); - }), - controller.isArrivedSend - ? MyElevatedButton( - title: 'I arrive you'.tr, - kolor: AppColor.yellowColor, - onPressed: () async { - if (controller - .calculateDistanceBetweenDriverAndPassengerLocation() < - 40) { - FirebaseMessagesController() - .sendNotificationToPassengerToken( - 'Hi ,I Arrive your site', - 'I Arrive your site' - .tr, - controller - .tokenPassenger, - []); - controller - .startTimerToShowDriverWaitPassengerDuration(); - controller - .isArrivedSend = - false; - } else { - Get.defaultDialog( - title: - 'You are not in near to passenger location' - .tr, - middleText: - 'please go to picker location exactly' - .tr, - confirm: - MyElevatedButton( - title: - 'Ok'.tr, - onPressed: - () { - Get.back(); - })); - } - }) - : const SizedBox() - ], - ), - controller.remainingTimeInPassengerLocatioWait < - 300 && - controller - .remainingTimeInPassengerLocatioWait != - 0 - ? Stack( - children: [ - LinearProgressIndicator( - backgroundColor: - AppColor.accentColor, - color: controller - .remainingTimeInPassengerLocatioWait < - 60 - ? AppColor.redColor - : AppColor.greenColor, - minHeight: 50, - borderRadius: - BorderRadius.circular( - 15), - value: controller - .progressInPassengerLocationFromDriver - .toDouble(), - ), - Center( - child: Text( - controller - .stringRemainingTimeWaitingPassenger, - style: AppStyle.title, - ), - ) - ], - ) - : controller.isdriverWaitTimeEnd - ? MyElevatedButton( - title: 'You Can Cancel Trip And get Cost of Trip From' - .tr + - ' ${AppInformation.appName}' - .tr, - kolor: AppColor - .deepPurpleAccent, - onPressed: () { - Get.defaultDialog( - title: - 'Are you sure to cancel?' - .tr, - titleStyle: - AppStyle.title, - middleText: '', - confirm: - MyElevatedButton( - title: - 'Yes'.tr, - onPressed: - () async { - FirebaseMessagesController().sendNotificationToPassengerToken( - 'Driver Cancel Your Trip', - 'You will be pay the cost to driver or we will get it from you on next trip' - .tr, - controller - .tokenPassenger, - []); - await controller - .addWaitingTimeCostFromPassengerToDriverWallet(); - controller - .isdriverWaitTimeEnd = - false; - })); - }) - : const SizedBox(), - ], - ), - ], - ), - ), - ), - ), - ], - ) - // : controller.remainingTimeToShowPassengerInfoWindowFromDriver > 0 // - // ? Positioned( - // bottom: Get.height * .2, - // left: 15, - // child: Container( - // decoration: AppStyle.boxDecoration, - // child: Padding( - // padding: const EdgeInsets.all(8.0), - // child: Row( - // children: [ - // Stack( - // alignment: Alignment.center, - // children: [ - // const CircularProgressIndicator( - // backgroundColor: AppColor.redColor, - // strokeWidth: 10, - // color: AppColor.redColor, - // value: 1, - // ), - // CircularProgressIndicator( - // value: controller.progress, - // // Set the color based on the "isNearEnd" condition - // color: AppColor.yellowColor, - // ), - // Text( - // '${controller.remainingTimeToShowPassengerInfoWindowFromDriver}', - // style: AppStyle.number, - // ), - // ], - // ), - // const SizedBox( - // width: 10, - // ), - // Text( - // 'Please Wait If passenger want To Cancel!'.tr, - // style: AppStyle.title, - // ), - // ], - // ), - // ), - // ), - // ) - : const SizedBox(), - ); - } -} diff --git a/lib/views/home/Captin/mapDriverWidgets/sos_connect.dart b/lib/views/home/Captin/mapDriverWidgets/sos_connect.dart deleted file mode 100644 index c89177d..0000000 --- a/lib/views/home/Captin/mapDriverWidgets/sos_connect.dart +++ /dev/null @@ -1,117 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_font_icons/flutter_font_icons.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/info.dart'; -import 'package:SEFER/controller/functions/location_controller.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; -import 'package:SEFER/views/widgets/my_textField.dart'; - -import '../../../../constant/box_name.dart'; -import '../../../../constant/colors.dart'; -import '../../../../constant/style.dart'; -import '../../../../controller/functions/launch.dart'; -import '../../../../controller/home/captin/map_driver_controller.dart'; -import '../../../../main.dart'; - -class SosConnect extends StatelessWidget { - const SosConnect({ - super.key, - }); - - @override - Widget build(BuildContext context) { - return GetBuilder( - builder: (mapDriverController) => mapDriverController.isRideStarted - ? Positioned( - left: 5, - bottom: 20, - child: Container( - decoration: AppStyle.boxDecoration, - height: 60, - width: 110, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - InkWell( - onTap: () { - if (box.read(BoxName.sosPhoneDriver) == null) { - Get.defaultDialog( - title: 'Insert Emergincy Number'.tr, - content: Form( - key: mapDriverController.formKey1, - child: MyTextForm( - controller: mapDriverController - .sosEmergincyNumberCotroller, - label: 'Insert Emergency Number'.tr, - hint: 'Insert Emergency Number'.tr, - type: TextInputType.phone), - ), - confirm: MyElevatedButton( - title: 'Insert'.tr, - onPressed: () { - if (mapDriverController - .formKey1.currentState! - .validate()) { - box.write( - BoxName.sosPhoneDriver, - mapDriverController - .sosEmergincyNumberCotroller - .text); - } - })); - } - launchCommunication( - 'phone', box.read(BoxName.sosPhoneDriver), ''); - }, - child: const Icon( - Icons.sos_sharp, - size: 45, - color: AppColor.redColor, - ), - ), - InkWell( - onTap: () { - if (box.read(BoxName.sosPhoneDriver) == null) { - Get.defaultDialog( - title: 'Insert Emergency Number'.tr, - content: Form( - key: mapDriverController.formKey1, - child: MyTextForm( - controller: mapDriverController - .sosEmergincyNumberCotroller, - label: 'Insert Emergency Number'.tr, - hint: 'Insert Emergency Number'.tr, - type: TextInputType.phone), - ), - confirm: MyElevatedButton( - title: 'Insert'.tr, - onPressed: () { - if (mapDriverController - .formKey1.currentState! - .validate()) { - box.write( - BoxName.sosPhoneDriver, - mapDriverController - .sosEmergincyNumberCotroller - .text); - } - })); - } else { - launchCommunication( - 'whatsapp', - '+02${box.read(BoxName.sosPhoneDriver)}', //todo add number from driver - "${"Hello this is Driver".tr} ${box.read(BoxName.nameDriver)}.${" My current location is:".tr} https://www.google.com/maps/place/${Get.find().myLocation.latitude},${Get.find().myLocation.longitude}${" \nand I have a trip on".tr} ${AppInformation.appName} ${"App \nwith Passenger ".tr}${mapDriverController.passengerName}"); - } - }, - child: const Icon( - FontAwesome.whatsapp, - color: AppColor.greenColor, - size: 45, - ), - ), - ], - ), - )) - : const SizedBox()); - } -} diff --git a/lib/views/home/Captin/orderCaptin/call.dart b/lib/views/home/Captin/orderCaptin/call.dart deleted file mode 100644 index f968864..0000000 --- a/lib/views/home/Captin/orderCaptin/call.dart +++ /dev/null @@ -1,25 +0,0 @@ -// import 'package:flutter/material.dart'; -// import 'package:ride/constant/api_key.dart'; -// import 'package:ride/constant/box_name.dart'; -// import 'package:ride/main.dart'; -// import 'package:zego_uikit_prebuilt_call/zego_uikit_prebuilt_call.dart'; - -// class CallPage extends StatelessWidget { -// const CallPage({Key? key, required this.callID}) : super(key: key); -// final String callID; - -// @override -// Widget build(BuildContext context) { -// return ZegoUIKitPrebuiltCall( -// appID: AK -// .zegoCloudAppID, // Fill in the appID that you get from ZEGOCLOUD Admin Console. -// appSign: AK -// .zegoCloudAppSIGN, // Fill in the appSign that you get from ZEGOCLOUD Admin Console. -// userID: box.read(BoxName.passengerID) ?? box.read(BoxName.driverID), -// userName: box.read(BoxName.name) ?? box.read(BoxName.nameDriver), -// callID: callID, -// // You can also use groupVideo/groupVoice/oneOnOneVoice to make more types of calls. -// config: ZegoUIKitPrebuiltCallConfig.oneOnOneVoiceCall(), -// ); -// } -// } diff --git a/lib/views/home/Captin/orderCaptin/order_request_page.dart b/lib/views/home/Captin/orderCaptin/order_request_page.dart deleted file mode 100644 index 83eb64d..0000000 --- a/lib/views/home/Captin/orderCaptin/order_request_page.dart +++ /dev/null @@ -1,435 +0,0 @@ -import 'package:SEFER/controller/home/captin/home_captain_controller.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/box_name.dart'; -import 'package:SEFER/controller/firebase/firbase_messge.dart'; -import 'package:SEFER/main.dart'; -import 'package:SEFER/views/home/Captin/driver_map_page.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'dart:math' as math; -import '../../../../constant/colors.dart'; -import '../../../../constant/links.dart'; -import '../../../../constant/style.dart'; -import '../../../../controller/functions/crud.dart'; -import '../../../../controller/functions/launch.dart'; -import '../../../../controller/home/captin/order_request_controller.dart'; -import '../../../widgets/elevated_btn.dart'; - -class OrderRequestPage extends StatelessWidget { - OrderRequestPage({super.key}); - OrderRequestController orderRequestController = - Get.put(OrderRequestController()); - @override - Widget build(BuildContext context) { - final arguments = Get.arguments; - final myListString = arguments['myListString']; - final myList = arguments['DriverList']; - // final pointsList = arguments['PolylineJson']; - final body = arguments['body']; - Duration durationToAdd = Duration(seconds: int.parse(myList[4])); - int hours = durationToAdd.inHours; - int minutes = (durationToAdd.inMinutes % 60).round(); - orderRequestController.startTimer(myList[6].toString(), body.toString()); - var coords = myList[0].split(','); - var coordDestination = myList[1].split(','); - BitmapDescriptor startIcon = BitmapDescriptor.defaultMarker; - BitmapDescriptor endIcon = BitmapDescriptor.defaultMarker; - -// Parse to double - double latPassengerLocation = double.parse(coords[0]); - double lngPassengerLocation = double.parse(coords[1]); - double latPassengerDestination = double.parse(coordDestination[0]); - double lngPassengerDestination = double.parse(coordDestination[1]); - - List pointsDirection = [ - LatLng(latPassengerLocation, lngPassengerLocation), - LatLng(latPassengerDestination, lngPassengerDestination) - ]; // Calculate the midpoint between the two points - // Calculate the minimum and maximum latitude and longitude values - double minLatitude = - math.min(pointsDirection[0].latitude, pointsDirection[1].latitude); - double maxLatitude = - math.max(pointsDirection[0].latitude, pointsDirection[1].latitude); - double minLongitude = - math.min(pointsDirection[0].longitude, pointsDirection[1].longitude); - double maxLongitude = - math.max(pointsDirection[0].longitude, pointsDirection[1].longitude); -// Create a bounding box using the calculated values - LatLngBounds bounds = LatLngBounds( - southwest: LatLng(minLatitude, minLongitude), - northeast: LatLng(maxLatitude, maxLongitude), - ); - // void addCustomStartIcon() async { -// Create the marker with the resized image - orderRequestController.calculateConsumptionFuel(); - - ImageConfiguration config = ImageConfiguration( - size: const Size(25, 25), devicePixelRatio: Get.pixelRatio); - BitmapDescriptor.fromAssetImage(config, 'assets/images/A.png', - mipmaps: false) - .then((value) { - startIcon = value; - }); - ImageConfiguration config1 = ImageConfiguration( - size: const Size(25, 25), devicePixelRatio: Get.pixelRatio); - BitmapDescriptor.fromAssetImage(config1, 'assets/images/b.png', - mipmaps: false) - .then((value) { - endIcon = value; - }); - // } - // orderRequestController.calculateConsumptionFuel(); - - return MyScafolld( - title: 'Order Details'.tr, - body: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 6), - child: ListView( - // crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // SizedBox(height: 200, child: Text(pointsList.toString())), - // Text(message.notification!.body.toString()), - SizedBox( - height: Get.height * .2, - child: GoogleMap( - initialCameraPosition: CameraPosition( - zoom: 12, - target: Get.find().myLocation), - cameraTargetBounds: CameraTargetBounds(bounds), - myLocationButtonEnabled: true, - trafficEnabled: true, - buildingsEnabled: true, - mapToolbarEnabled: true, - myLocationEnabled: true, - markers: { - Marker( - markerId: MarkerId('MyLocation'.tr), - position: LatLng( - latPassengerLocation, lngPassengerLocation), - draggable: true, - icon: startIcon), - Marker( - markerId: MarkerId('Destination'.tr), - position: LatLng( - latPassengerDestination, lngPassengerDestination), - draggable: true, - icon: endIcon), - }, - polylines: { - Polyline( - zIndex: 1, - consumeTapEvents: true, - geodesic: true, - endCap: Cap.buttCap, - startCap: Cap.buttCap, - visible: true, - polylineId: const PolylineId('routeOrder'), - points: pointsDirection, - color: AppColor.primaryColor, - width: 2, - ), - }, - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Card( - elevation: 3, - color: myList[20].toString() == 'haveSteps' - ? AppColor.greenColor - : AppColor.secondaryColor, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - TextButton.icon( - onPressed: () { - String mapUrl = - 'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/'; - print(mapUrl); - showInBrowser(mapUrl); - }, - icon: const Icon(Icons.map), - label: myList[20].toString() == 'haveSteps' - ? Text( - 'Trip has Steps'.tr, - style: AppStyle.title, - ) - : Text('Rouats of Trip'.tr, - style: AppStyle.title)), - Container( - color: myList[13].toString() == 'true' - ? AppColor.deepPurpleAccent - : AppColor.greenColor, - child: myList[13].toString() == - 'true' //Visa or Cash Method from notify to driver - ? Text( - 'Visa', - style: AppStyle.title, - ) - : Text('Cash', style: AppStyle.title), - ) - ], - ), - ), - ), - - Container( - decoration: AppStyle.boxDecoration1, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Text( - double.parse(myList[2]).toStringAsFixed(2), - style: AppStyle.headTitle2, - ), - Text( - myList[31].toString(), - style: AppStyle.title - .copyWith(color: AppColor.greenColor), - ), - ], - )), - ), - Container( - height: Get.height * .2, - width: Get.width * .9, - decoration: AppStyle.boxDecoration1, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - const Icon( - Icons.arrow_circle_up, - color: AppColor.greenColor, - ), - Text( - myList[12] + ' ' + ' (${myList[11]}) ', - style: AppStyle.title, - ), - ], - ), - Text( - myList[29], - style: AppStyle.title, - ), - ], - ), - Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - const Icon( - Icons.arrow_circle_up, - color: AppColor.greenColor, - ), - Text( - myList[5] + ' ' + ' (${myList[4]}) ', - style: AppStyle.title, - ), - ], - ), - Text( - myList[30], - style: AppStyle.title, - ), - ], - ), - ], - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: RichText( - text: TextSpan( - text: 'Passenger name : ' - .tr, // Changed text to be more generic - style: AppStyle.subtitle, - children: [ - TextSpan( - text: myList[8], - style: AppStyle - .title), // Assuming myList[8] holds passenger name - TextSpan(text: ' (', style: AppStyle.subtitle), - TextSpan( - text: myList[33].toString(), - style: AppStyle - .title), // Assuming 'rate' holds the passenger rate - TextSpan(text: ' ⭐)', style: AppStyle.subtitle), - ], - ), - ), - ), - - Padding( - padding: const EdgeInsets.all(4), - child: Container( - color: AppColor.deepPurpleAccent, - child: RichText( - text: TextSpan( - text: 'Cost Of Trip IS '.tr, - style: AppStyle.title, - children: [ - TextSpan( - text: myList[26], style: AppStyle.headTitle2), - ], - ), - ), - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - MyElevatedButton( - kolor: AppColor.greenColor, - title: 'Accept Order'.tr, - onPressed: () async { - box.write(BoxName.statusDriverLocation, 'on'); - - orderRequestController.changeApplied(); - await CRUD().postFromDialogue( - link: AppLink.addDriverOrder, - payload: { - 'driver_id': myList[6].toString(), - // box.read(BoxName.driverID).toString(), - 'order_id': body.toString(), - 'status': 'Apply' - }); - await CRUD() - .post(link: AppLink.updateRides, payload: { - 'id': myList[16], - 'rideTimeStart': DateTime.now().toString(), - 'status': 'Apply', - 'driver_id': box.read(BoxName.driverID), - }); - // Get.back(); - List bodyToPassenger = [ - box.read(BoxName.driverID).toString(), - box.read(BoxName.nameDriver).toString(), - box.read(BoxName.tokenDriver).toString(), - ]; - // print(bodyToPassenger); - FirebaseMessagesController() - .sendNotificationToPassengerToken( - 'Apply Ride', 'your ride is applied'.tr, - // arguments['DriverList'][9].toString(), - arguments['DriverList'][9].toString(), - // box.read(BoxName.tokenDriver).toString(), - bodyToPassenger, - ); - Get.back(); - Get.to(() => PassengerLocationMapPage(), arguments: { - 'passengerLocation': myList[0].toString(), - 'passengerDestination': myList[1].toString(), - 'Duration': myList[4].toString(), - 'totalCost': myList[26].toString(), - 'Distance': myList[5].toString(), - 'name': myList[8].toString(), - 'phone': myList[10].toString(), - 'email': myList[28].toString(), - 'WalletChecked': myList[13].toString(), - 'tokenPassenger': myList[9].toString(), - 'direction': - 'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/', - 'DurationToPassenger': myList[15].toString(), - 'rideId': myList[16].toString(), - 'passengerId': myList[7].toString(), - 'driverId': myList[18].toString(), - 'durationOfRideValue': myList[19].toString(), - 'paymentAmount': myList[2].toString(), - 'paymentMethod': myList[13].toString() == 'true' - ? 'visa' - : 'cash', - 'isHaveSteps': myList[20].toString(), - 'step0': myList[21].toString(), - 'step1': myList[22].toString(), - 'step2': myList[23].toString(), - 'step3': myList[24].toString(), - 'step4': myList[25].toString(), - 'passengerWalletBurc': myList[26].toString(), - 'timeOfOrder': DateTime.now().toString(), - 'totalPassenger': myList[2].toString(), - 'carType': myList[31].toString(), - 'kazan': myList[32].toString(), - }); - }, - ), - GetBuilder( - builder: (timerController) { - final isNearEnd = timerController.remainingTime <= - 5; // Define a threshold for "near end" - - return Stack( - alignment: Alignment.center, - children: [ - CircularProgressIndicator( - value: timerController.progress, - // Set the color based on the "isNearEnd" condition - color: isNearEnd ? Colors.red : Colors.blue, - ), - Text( - '${timerController.remainingTime}', - style: AppStyle.number, - ), - ], - ); - }, - ), - MyElevatedButton( - title: 'Refuse Order'.tr, - onPressed: () async { - List bodyToPassenger = [ - box.read(BoxName.driverID).toString(), - box.read(BoxName.nameDriver).toString(), - box.read(BoxName.tokenDriver).toString(), - ]; - - FirebaseMessagesController() - .sendNotificationToPassengerToken( - 'Refused Ride', - '${box.read(BoxName.nameDriver)} ${'reject your order.'.tr}', - arguments['DriverList'][9].toString(), - // box.read(BoxName.tokenDriver).toString(), - bodyToPassenger, - ); - orderRequestController.refuseOrder( - myList[16].toString(), - ); - orderRequestController.addRideToNotificationDriverString( - myList[16].toString(), - myList[29].toString(), - myList[30].toString(), - '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day}', - '${DateTime.now().hour}:${DateTime.now().minute}', - myList[2].toString(), - myList[7].toString(), - 'wait', - myList[31].toString(), - myList[33].toString(), - myList[2].toString(), - myList[5].toString(), - myList[4].toString()); //duration - }, - kolor: AppColor.redColor, - ), - ], - ), - ) - ], - ), - ) - ], - isleading: true); - } -} diff --git a/lib/views/home/Captin/orderCaptin/order_speed_request.dart b/lib/views/home/Captin/orderCaptin/order_speed_request.dart deleted file mode 100644 index c11314b..0000000 --- a/lib/views/home/Captin/orderCaptin/order_speed_request.dart +++ /dev/null @@ -1,464 +0,0 @@ -import 'dart:convert'; - -import 'package:SEFER/controller/functions/tts.dart'; -import 'package:SEFER/controller/home/captin/home_captain_controller.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/box_name.dart'; -import 'package:SEFER/controller/firebase/firbase_messge.dart'; -import 'package:SEFER/main.dart'; -import 'package:SEFER/views/home/Captin/driver_map_page.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'dart:math' as math; -import '../../../../constant/colors.dart'; -import '../../../../constant/links.dart'; -import '../../../../constant/style.dart'; -import '../../../../controller/functions/crud.dart'; -import '../../../../controller/functions/launch.dart'; -import '../../../../controller/home/captin/order_request_controller.dart'; -import '../../../widgets/elevated_btn.dart'; - -class OrderSpeedRequest extends StatelessWidget { - OrderSpeedRequest({super.key}); - OrderRequestController orderRequestController = - Get.put(OrderRequestController()); - @override - Widget build(BuildContext context) { - final arguments = Get.arguments; - final myListString = arguments['myListString']; - final myList = arguments['DriverList']; - // final pointsList = arguments['PolylineJson']; - final body = arguments['body']; - Duration durationToAdd = Duration(seconds: int.parse(myList[4])); - int hours = durationToAdd.inHours; - int minutes = (durationToAdd.inMinutes % 60).round(); - orderRequestController.startTimerSpeed( - myList[6].toString(), body.toString()); - var coords = myList[0].split(','); - var coordDestination = myList[1].split(','); - BitmapDescriptor startIcon = BitmapDescriptor.defaultMarker; - BitmapDescriptor endIcon = BitmapDescriptor.defaultMarker; - -// Parse to double - double latPassengerLocation = double.parse(coords[0]); - double lngPassengerLocation = double.parse(coords[1]); - double latPassengerDestination = double.parse(coordDestination[0]); - double lngPassengerDestination = double.parse(coordDestination[1]); - - List pointsDirection = [ - LatLng(latPassengerLocation, lngPassengerLocation), - LatLng(latPassengerDestination, lngPassengerDestination) - ]; // Calculate the midpoint between the two points - // Calculate the minimum and maximum latitude and longitude values - double minLatitude = - math.min(pointsDirection[0].latitude, pointsDirection[1].latitude); - double maxLatitude = - math.max(pointsDirection[0].latitude, pointsDirection[1].latitude); - double minLongitude = - math.min(pointsDirection[0].longitude, pointsDirection[1].longitude); - double maxLongitude = - math.max(pointsDirection[0].longitude, pointsDirection[1].longitude); -// Create a bounding box using the calculated values - LatLngBounds bounds = LatLngBounds( - southwest: LatLng(minLatitude, minLongitude), - northeast: LatLng(maxLatitude, maxLongitude), - ); - // void addCustomStartIcon() async { -// Create the marker with the resized image - orderRequestController.calculateConsumptionFuel(); - - ImageConfiguration config = ImageConfiguration( - size: const Size(25, 25), devicePixelRatio: Get.pixelRatio); - BitmapDescriptor.fromAssetImage(config, 'assets/images/A.png', - mipmaps: false) - .then((value) { - startIcon = value; - }); - ImageConfiguration config1 = ImageConfiguration( - size: const Size(25, 25), devicePixelRatio: Get.pixelRatio); - BitmapDescriptor.fromAssetImage(config1, 'assets/images/b.png', - mipmaps: false) - .then((value) { - endIcon = value; - }); - // } - // double mpg = 0; - // calculateConsumptionFuel() { - // mpg = Get.find().fuelPrice / - // 12; //todo in register car add mpg in box - // } - - return MyScafolld( - title: 'Order Details'.tr, - body: [ - ListView( - // crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // SizedBox(height: 200, child: Text(pointsList.toString())), - // Text(message.notification!.body.toString()), - SizedBox( - height: Get.height * .2, - child: GoogleMap( - initialCameraPosition: CameraPosition( - zoom: 12, - target: Get.find().myLocation), - cameraTargetBounds: CameraTargetBounds(bounds), - myLocationButtonEnabled: true, - trafficEnabled: true, - buildingsEnabled: true, - mapToolbarEnabled: true, - myLocationEnabled: true, - markers: { - Marker( - markerId: MarkerId('MyLocation'.tr), - position: - LatLng(latPassengerLocation, lngPassengerLocation), - draggable: true, - icon: startIcon), - Marker( - markerId: MarkerId('Destination'.tr), - position: LatLng( - latPassengerDestination, lngPassengerDestination), - draggable: true, - icon: endIcon), - }, - polylines: { - Polyline( - zIndex: 1, - consumeTapEvents: true, - geodesic: true, - endCap: Cap.buttCap, - startCap: Cap.buttCap, - visible: true, - polylineId: const PolylineId('routeOrder'), - points: pointsDirection, - color: AppColor.primaryColor, - width: 2, - ), - }, - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Card( - elevation: 3, - color: myList[20].toString() == 'haveSteps' - ? AppColor.greenColor - : AppColor.secondaryColor, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - TextButton.icon( - onPressed: () { - String mapUrl = - 'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/'; - print(mapUrl); - showInBrowser(mapUrl); - }, - icon: const Icon(Icons.map), - label: myList[20].toString() == 'haveSteps' - ? Text( - 'Trip has Steps'.tr, - style: AppStyle.title, - ) - : Text('Rouats of Trip'.tr, - style: AppStyle.title)), - Container( - color: myList[13].toString() == 'true' - ? AppColor.deepPurpleAccent - : AppColor.greenColor, - child: myList[13].toString() == - 'true' //Visa or Cash Method from notify to driver - ? Text( - 'Visa', - style: AppStyle.title, - ) - : Text('Cash', style: AppStyle.title), - ) - ], - ), - ), - ), - - Container( - decoration: AppStyle.boxDecoration1, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Text( - double.parse(myList[2]).toStringAsFixed(2), - style: AppStyle.headTitle2, - ), - Text( - myList[31].toString(), - style: AppStyle.title - .copyWith(color: AppColor.greenColor), - ), - ], - )), - ), - Container( - height: Get.height * .2, - width: Get.width * .9, - decoration: AppStyle.boxDecoration1, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - const Icon( - Icons.arrow_circle_up, - color: AppColor.greenColor, - ), - Text( - myList[12] + ' ' + ' (${myList[11]}) ', - style: AppStyle.title, - ), - ], - ), - Text( - myList[29], - style: AppStyle.title, - ), - ], - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - const Icon( - Icons.arrow_circle_up, - color: AppColor.greenColor, - ), - Text( - myList[5] + ' ' + ' (${myList[4]}) ', - style: AppStyle.title, - ), - ], - ), - Text( - myList[30], - style: AppStyle.title, - ), - ], - ), - ], - ), - ], - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: RichText( - text: TextSpan( - text: 'Passenger name : ' - .tr, // Changed text to be more generic - style: AppStyle.subtitle, - children: [ - TextSpan( - text: myList[8], - style: AppStyle - .title), // Assuming myList[8] holds passenger name - TextSpan(text: ' (', style: AppStyle.subtitle), - TextSpan( - text: myList[33].toString(), - style: AppStyle - .title), // Assuming 'rate' holds the passenger rate - TextSpan(text: ' ⭐)', style: AppStyle.subtitle), - ], - ), - ), - ), - Padding( - padding: const EdgeInsets.all(4), - child: Container( - color: AppColor.deepPurpleAccent, - child: RichText( - text: TextSpan( - text: 'Cost Of Trip IS '.tr, - style: AppStyle.title, - children: [ - TextSpan(text: myList[26], style: AppStyle.headTitle2), - ], - ), - ), - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - MyElevatedButton( - kolor: AppColor.greenColor, - title: 'Accept Order'.tr, - onPressed: () async { - box.write(BoxName.statusDriverLocation, 'on'); - - var res = await CRUD() - .post(link: AppLink.updateStausFromSpeed, payload: { - 'id': myList[16], - 'rideTimeStart': DateTime.now().toString(), - 'status': 'Apply', - 'driver_id': box.read(BoxName.driverID), - }); - // .then((value) { - // var json = jsonDecode(res); - print('res $res'); - if (res == "failure") { - Get.defaultDialog( - title: - "This ride is already taken by another driver." - .tr, - middleText: '', - titleStyle: AppStyle.title, - middleTextStyle: AppStyle.title, - confirm: MyElevatedButton( - title: 'Ok'.tr, - onPressed: () { - Get.back(); - Get.back(); - Get.back(); - })); - } else if (jsonDecode(res)['status'] == "success") { - List bodyToPassenger = [ - box.read(BoxName.driverID).toString(), - box.read(BoxName.nameDriver).toString(), - box.read(BoxName.tokenDriver).toString(), - ]; - await CRUD().postFromDialogue( - link: AppLink.addDriverOrder, - payload: { - 'driver_id': myList[6].toString(), - // box.read(BoxName.driverID).toString(), - 'order_id': body.toString(), - 'status': 'Apply' - }); - // print(bodyToPassenger); - FirebaseMessagesController() - .sendNotificationToPassengerToken( - 'Apply Ride', 'your ride is applied'.tr, - // arguments['DriverList'][9].toString(), - arguments['DriverList'][9].toString(), - // box.read(BoxName.tokenDriver).toString(), - bodyToPassenger, - ); - Get.back(); - Get.to(() => PassengerLocationMapPage(), arguments: { - 'passengerLocation': myList[0].toString(), - 'passengerDestination': myList[1].toString(), - 'Duration': myList[4].toString(), - 'totalCost': myList[26].toString(), - 'Distance': myList[5].toString(), - 'name': myList[8].toString(), - 'phone': myList[10].toString(), - 'email': myList[28].toString(), - 'WalletChecked': myList[13].toString(), - 'tokenPassenger': myList[9].toString(), - 'direction': - 'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/', - 'DurationToPassenger': myList[15].toString(), - 'rideId': myList[16].toString(), - 'passengerId': myList[7].toString(), - 'driverId': myList[18].toString(), - 'durationOfRideValue': myList[19].toString(), - 'paymentAmount': myList[2].toString(), - 'paymentMethod': myList[13].toString() == 'true' - ? 'visa' - : 'cash', - 'isHaveSteps': myList[20].toString(), - 'step0': myList[21].toString(), - 'step1': myList[22].toString(), - 'step2': myList[23].toString(), - 'step3': myList[24].toString(), - 'step4': myList[25].toString(), - 'passengerWalletBurc': myList[26].toString(), - 'timeOfOrder': DateTime.now().toString(), - 'totalPassenger': myList[2].toString(), - 'carType': myList[31].toString(), - 'kazan': myList[32].toString(), - }); - } - // }); - // Get.back(); - }, - ), - GetBuilder( - builder: (timerController) { - final isNearEnd = timerController.remainingTimeSpeed <= - 5; // Define a threshold for "near end" - - return Stack( - alignment: Alignment.center, - children: [ - CircularProgressIndicator( - value: timerController.progressSpeed, - // Set the color based on the "isNearEnd" condition - color: isNearEnd ? Colors.red : Colors.blue, - ), - Text( - '${timerController.remainingTimeSpeed}', - style: AppStyle.number, - ), - ], - ); - }, - ), - MyElevatedButton( - title: 'Refuse Order'.tr, - onPressed: () async { - Get.defaultDialog( - title: 'Reject Order'.tr, - titleStyle: AppStyle.title, - content: Column( - children: [ - IconButton( - onPressed: () async { - await Get.find() - .speakText( - 'You can decline a request without any cost' - .tr); - }, - icon: const Icon(Icons.headphones), - ), - Text( - 'You can decline a request without any cost' - .tr, - style: AppStyle.title, - ) - ], - ), - confirm: MyElevatedButton( - title: 'Ok'.tr, - onPressed: () { - Get.back(); - Get.back(); - })); - }, - kolor: AppColor.redColor, - ), - ], - ), - ) - ], - ) - ], - isleading: true); - } -} diff --git a/lib/views/home/Captin/passportimage.dart b/lib/views/home/Captin/passportimage.dart deleted file mode 100644 index 61c4791..0000000 --- a/lib/views/home/Captin/passportimage.dart +++ /dev/null @@ -1,46 +0,0 @@ -// import 'dart:io'; -// -// import 'package:flutter/material.dart'; -// import 'package:get/get.dart'; -// import '../../../controller/functions/ocr_controller.dart'; -// -// class PassportDataExtractorWidget extends StatelessWidget { -// final PassportDataExtractor passportDataExtractor = -// Get.put(PassportDataExtractor()); -// final PassportDataController controller = Get.put(PassportDataController()); -// -// @override -// Widget build(BuildContext context) { -// return Scaffold( -// appBar: AppBar( -// title: const Text('Passport Data Extractor'), -// ), -// body: Column( -// children: [ -// ElevatedButton( -// onPressed: controller.extractDataAndDrawBoundingBoxes, -// child: const Text('Extract Data'), -// ), -// Expanded( -// child: Center( -// child: Stack( -// children: [ -// GetBuilder( -// builder: (controller) => CustomPaint( -// painter: BoundingBoxPainter( -// controller.extractedTextWithCoordinates), -// child: GetBuilder( -// builder: (controller) => -// Image.file(File(passportDataExtractor.image!.path)), -// ), -// ), -// ), -// ], -// ), -// ), -// ), -// ], -// ), -// ); -// } -// } diff --git a/lib/views/home/Captin/settings_captain.dart b/lib/views/home/Captin/settings_captain.dart deleted file mode 100644 index 25b8a50..0000000 --- a/lib/views/home/Captin/settings_captain.dart +++ /dev/null @@ -1,90 +0,0 @@ -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/controller/profile/setting_controller.dart'; -import 'package:SEFER/views/home/profile/passenger_profile_page.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_font_icons/flutter_font_icons.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/views/lang/languages.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; - -class SettingsCaptain extends StatelessWidget { - const SettingsCaptain({super.key}); - - @override - Widget build(BuildContext context) { - Get.put(SettingController()); - return MyScafolld( - title: 'Settings'.tr, - body: [ - ListView( - children: [ - ListTile( - leading: const Icon(Icons.language), - title: Text( - 'Language'.tr, - style: AppStyle.headTitle2, - ), - subtitle: Text('You can change the language of the app'.tr), - onTap: () => Get.to(const Language()), - ), - const Divider( - endIndent: 44, - indent: 44, - ), - ListTile( - leading: const Icon(Icons.place_outlined), - title: Text( - 'Change Country'.tr, - style: AppStyle.headTitle2, - ), - subtitle: - Text('You can change the Country to get all features'.tr), - onTap: () => Get.to(MyScafolld( - title: 'Change Country'.tr, - body: [CountryPickerFromSetting()], - isleading: true)), - ), - const Divider( - endIndent: 44, - indent: 44, - ), - ListTile( - leading: const Icon( - MaterialCommunityIcons.map_marker_radius, - color: AppColor.redColor, - ), - title: Text( - 'Google Map App'.tr, - style: AppStyle.headTitle2, - ), - subtitle: Text( - 'If you want to make Google Map App run directly when you apply order' - .tr), - trailing: - GetBuilder(builder: (settingController) { - return CupertinoSwitch( - value: settingController.isGoogleMapsEnabled, - onChanged: (bool value) { - settingController.onChangMapApp(); - }, - ); - }), - ), - const Divider( - endIndent: 44, - indent: 44, - ), - // ListTile( - // leading: const Icon(Icons.account_circle), - // title: const Text('Account'), - // onTap: () => Navigator.pushNamed(context, '/account-settings'), - // ), - ], - ), - ], - isleading: true, - ); - } -} diff --git a/lib/views/home/Captin/text_scanner.dart b/lib/views/home/Captin/text_scanner.dart deleted file mode 100644 index 9345d36..0000000 --- a/lib/views/home/Captin/text_scanner.dart +++ /dev/null @@ -1,175 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/views/widgets/mycircular.dart'; - -import '../../../controller/functions/ocr_controller.dart'; - -class TextRecognizerAPI extends StatelessWidget { - const TextRecognizerAPI({super.key}); - - @override - Widget build(BuildContext context) { - Get.put(ScanDocumentsByApi()); - return GetBuilder( - builder: (controller) => Scaffold( - appBar: AppBar( - title: Text('Api'), - actions: [ - IconButton( - onPressed: () { - controller.matchFaceApi(); - }, - icon: const Icon(Icons.face), - ), - ], - ), - body: Center( - child: controller.isLoading - ? const MyCircularProgressIndicator() - : SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Image.memory( - controller.imagePortrait, - width: 60, - ), - Image.memory( - controller.imageSignature, - width: 60, - ), - Image.memory( - controller.imageDocumentFrontSide, - width: 250, - ), - ], - ), - Text(controller.responseMap['authenticity_meta'] - .toString()), - Text( - 'countryName: ${controller.responseMap['data']['countryName'].toString()}'), - Text( - 'Expiry Date: ${controller.responseMap['data']['ocr']['dateOfExpiry'].toString()}'), - // Add more Text widgets to display other record values - Text( - 'Address: ${controller.responseMap['data']['ocr']['address'].toString()}'), - Text( - 'City: ${controller.responseMap['data']['ocr']['addressCity'].toString()}'), - Text( - 'Jurisdiction Code: ${controller.responseMap['data']['ocr']['addressJurisdictionCode'].toString()}'), - Text( - 'Postal Code: ${controller.responseMap['data']['ocr']['addressPostalCode'].toString()}'), - Text( - 'Street: ${controller.responseMap['data']['ocr']['addressStreet'].toString()}'), - Text( - 'Date of Birth: ${controller.responseMap['data']['ocr']['dateOfBirth'].toString()}'), - Text( - 'Date of Issue: ${controller.responseMap['data']['ocr']['dateOfIssue'].toString()}'), - Text( - 'Drivers License Class: ${controller.responseMap['data']['ocr']['dlClass'].toString()}'), - Text( - 'Document Number: ${controller.responseMap['data']['ocr']['documentNumber'].toString()}'), - Text( - 'Eye Color: ${controller.responseMap['data']['ocr']['eyesColor'].toString()}'), - Text( - 'Given Names: ${controller.responseMap['data']['ocr']['givenNames'].toString()}'), - Text( - 'Height: ${controller.responseMap['data']['ocr']['height'].toString()}'), - Text( - 'Issuing State Code: ${controller.responseMap['data']['ocr']['issuingStateCode'].toString()}'), - Text( - 'Name: ${controller.responseMap['data']['ocr']['name'].toString()}'), - Text( - 'Sex: ${controller.responseMap['data']['ocr']['sex'].toString()}'), - Text( - 'Surname: ${controller.responseMap['data']['ocr']['surname'].toString()}'), - Text( - 'Valid State: ${controller.responseMap['data']['ocr']['validState'].toString()}'), - ], - ), - )))); - } -} -// class TextExtractionView extends StatelessWidget { -// TextExtractionView({super.key}); -// -// @override -// Widget build(BuildContext context) { -// Get.put(TextExtractionController()); -// return Scaffold( -// appBar: AppBar( -// title: const Text('Text Extraction'), -// ), -// body: GetBuilder(builder: (controller) { -// return Center( -// child: Column( -// mainAxisAlignment: MainAxisAlignment.center, -// children: [ -// ElevatedButton( -// onPressed: () {}, -// child: const Text('Pick Image and Extract Text'), -// ), -// const SizedBox(height: 20), -// controller.isloading -// ? const MyCircularProgressIndicator() -// : Text(controller.extractedText), -// ], -// ), -// ); -// }), -// ); -// } -// } - -// class TextRecognizerWidget extends StatelessWidget { -// const TextRecognizerWidget({super.key}); -// -// @override -// Widget build(BuildContext context) { -// Get.put(TextMLGoogleRecognizerController()); -// return GetBuilder( -// builder: (controller) => Scaffold( -// appBar: AppBar(), -// body: Center( -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// Text('${controller.decode['DRIVER_LICENSE'].toString()}'), -// Text('DL: ${controller.decode['dl_number'].toString()}'), -// Text( -// 'Expiry Date: ${controller.decode['expiry_date'].toString()}'), -// Text('Last Name: ${controller.decode['lastName'].toString()}'), -// Text( -// 'First Name: ${controller.decode['firstName'].toString()}'), -// Text('Address: ${controller.decode['address'].toString()}'), -// Text('Date of Birth: ${controller.decode['dob'].toString()}'), -// Text('RSTR: ${controller.decode['rstr'].toString()}'), -// Text('Class: ${controller.decode['class'].toString()}'), -// Text('End: ${controller.decode['end'].toString()}'), -// Text('DD: ${controller.decode['dd'].toString()}'), -// Text('Sex: ${controller.decode['sex'].toString()}'), -// Text('Hair: ${controller.decode['hair'].toString()}'), -// Text('Eyes: ${controller.decode['eyes'].toString()}'), -// // and so on for other fields -// ], -// )))); -// } -// } - -// class PassportPage extends StatelessWidget { -// PassportPage({super.key}); -// PassportRecognizerController passportRecognizerController = -// Get.put(PassportRecognizerController()); -// @override -// Widget build(BuildContext context) { -// return Scaffold( -// appBar: AppBar( -// title: const Text('Driver License'), -// ), -// body: const Center(child: Text('data'))); -// } -// } diff --git a/lib/views/home/map_widget.dart/apply_order_widget.dart b/lib/views/home/map_widget.dart/apply_order_widget.dart index 44a76ba..78ea68e 100644 --- a/lib/views/home/map_widget.dart/apply_order_widget.dart +++ b/lib/views/home/map_widget.dart/apply_order_widget.dart @@ -3,7 +3,6 @@ import 'package:SEFER/constant/style.dart'; import 'package:SEFER/controller/firebase/firbase_messge.dart'; import 'package:SEFER/controller/home/map_passenger_controller.dart'; import 'package:SEFER/main.dart'; -import 'package:SEFER/views/home/Captin/home_captain/widget/call_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:get/get.dart'; @@ -261,7 +260,7 @@ class ApplyOrderWidget extends StatelessWidget { IconButton( onPressed: () { HapticFeedback.heavyImpact(); - Get.to(() => const CallPage()); + // Get.to(() => const CallPage()); // Get.to(() => PassengerCallPage()); }, icon: const Icon( diff --git a/lib/views/home/map_widget.dart/map_menu_widget.dart b/lib/views/home/map_widget.dart/map_menu_widget.dart index 83d1b4e..9dd8fa1 100644 --- a/lib/views/home/map_widget.dart/map_menu_widget.dart +++ b/lib/views/home/map_widget.dart/map_menu_widget.dart @@ -3,7 +3,6 @@ import 'package:flutter_font_icons/flutter_font_icons.dart'; import 'package:get/get.dart'; import 'package:get/get_rx/src/rx_typedefs/rx_typedefs.dart'; import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/views/auth/captin/register_captin.dart'; import 'package:SEFER/views/home/my_wallet/passenger_wallet.dart'; import 'package:SEFER/views/home/profile/feed_back_page.dart'; import 'package:SEFER/views/home/profile/order_history.dart'; @@ -162,7 +161,8 @@ class MapMenuWidget extends StatelessWidget { children: [ IconMainPageMap( onTap: () { - Get.to(const RegisterCaptin()); + // Get.to(const RegisterCaptin()); + //todo use url to use driver app }, title: 'Driver'.tr, icon: WeatherIcons.wi_moon_14, diff --git a/lib/views/home/map_widget.dart/points_page_for_rider.dart b/lib/views/home/map_widget.dart/points_page_for_rider.dart index 8a20764..412fe5b 100644 --- a/lib/views/home/map_widget.dart/points_page_for_rider.dart +++ b/lib/views/home/map_widget.dart/points_page_for_rider.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/views/admin/captain/form_captain.dart'; import '../../../constant/colors.dart'; import '../../../controller/home/map_passenger_controller.dart'; @@ -269,10 +268,10 @@ void showAddLocationDialog(BuildContext context, int index) { ) ], ), - SizedBox( - width: Get.width, - child: formSearchCaptain(), - ), + // SizedBox( + // width: Get.width, + // child: formSearchCaptain(), + // ), ], ), ); diff --git a/lib/views/home/profile/order_history.dart b/lib/views/home/profile/order_history.dart index d14ce97..0d10ea1 100644 --- a/lib/views/home/profile/order_history.dart +++ b/lib/views/home/profile/order_history.dart @@ -1,5 +1,4 @@ import 'package:SEFER/controller/home/map_passenger_controller.dart'; -import 'package:SEFER/main.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:SEFER/constant/style.dart'; diff --git a/lib/views/notification/available_rides_page.dart b/lib/views/notification/available_rides_page.dart deleted file mode 100644 index 3954753..0000000 --- a/lib/views/notification/available_rides_page.dart +++ /dev/null @@ -1,265 +0,0 @@ -import 'dart:convert'; - -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/controller/home/captin/home_captain_controller.dart'; -import 'package:SEFER/controller/notification/ride_available_controller.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; -import 'package:SEFER/views/widgets/mycircular.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; - -import '../../constant/box_name.dart'; -import '../../constant/links.dart'; -import '../../controller/firebase/firbase_messge.dart'; -import '../../controller/functions/crud.dart'; -import '../../main.dart'; -import '../home/Captin/driver_map_page.dart'; - -class AvailableRidesPage extends StatelessWidget { - const AvailableRidesPage({super.key}); - - @override - Widget build(BuildContext context) { - Get.put(RideAvailableController()); - return GetBuilder( - builder: (rideAvailableController) { - return MyScafolld( - title: 'Available for rides'.tr, - body: [ - rideAvailableController.isLoading - ? const MyCircularProgressIndicator() - : Padding( - padding: const EdgeInsets.all(8.0), - child: rideAvailableController - .rideAvailableMap['message'].length == - 1 && - rideAvailableController.rideAvailableMap['message'] - [0]['start_location'] == - null - ? Center( - child: Text( - 'No ride found yet'.tr, - style: AppStyle.headTitle2, - ), - ) - : ListView.builder( - itemCount: rideAvailableController - .rideAvailableMap['message'].length, - itemBuilder: (BuildContext context, int index) { - var list = rideAvailableController - .rideAvailableMap['message'][index]; - return Container( - width: Get.width * .9, - decoration: AppStyle.boxDecoration1, - child: Column( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - Text( - ' ${list['start_location']}', - style: AppStyle.title, - ), - Text( - '${list['end_location']}', - style: AppStyle.title, - ), - const SizedBox(height: 4), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - Text( - '${'Price: '.tr}${list['price']} \$'), - const SizedBox(height: 4), - Text( - '${list['carType']}', - style: AppStyle.title.copyWith( - color: AppColor.greenColor), - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - Text('📈 ${list['passengerRate']}', - style: AppStyle.title), - MyElevatedButton( - title: 'Accept'.tr, - onPressed: () async { - box.write( - BoxName.statusDriverLocation, - 'on'); - - var res = await CRUD().post( - link: AppLink - .updateStausFromSpeed, - payload: { - 'id': list['id'], - 'rideTimeStart': - DateTime.now().toString(), - 'status': 'Apply', - 'driver_id': box - .read(BoxName.driverID), - }); - // .then((value) { - // var json = jsonDecode(res); - print('res $res'); - if (res == "failure") { - Get.defaultDialog( - title: - "This ride is already taken by another driver." - .tr, - middleText: '', - titleStyle: AppStyle.title, - middleTextStyle: - AppStyle.title, - confirm: MyElevatedButton( - title: 'Ok'.tr, - onPressed: () { - Get.back(); - Get.back(); - Get.back(); - })); - } else if (jsonDecode( - res)['status'] == - "success") { - List bodyToPassenger = [ - box - .read(BoxName.driverID) - .toString(), - box - .read(BoxName.nameDriver) - .toString(), - box - .read(BoxName.tokenDriver) - .toString(), - ]; - await CRUD().postFromDialogue( - link: AppLink.addDriverOrder, - payload: { - 'driver_id': box - .read(BoxName.driverID), - // box.read(BoxName.driverID).toString(), - 'order_id': list['id'], - 'status': 'Apply' - }); - await CRUD().post( - link: AppLink.updateRides, - payload: { - 'id': list['id'], - 'driverGoToPassengerTime': - DateTime.now() - .toString(), - 'status': 'Applied' - }); - - // print(bodyToPassenger); - FirebaseMessagesController() - .sendNotificationToPassengerToken( - 'Apply Ride', - 'your ride is applied'.tr, - // arguments['DriverList'][9].toString(), - list['passengerToken'] - .toString(), - // box.read(BoxName.tokenDriver).toString(), - bodyToPassenger, - ); - Get.back(); - Get.to( - () => - PassengerLocationMapPage(), - arguments: { - 'passengerLocation': - list['start_location'] - .toString(), - 'passengerDestination': - list['end_location'] - .toString(), - 'Duration': list['duration'] - .toString(), - 'totalCost': list['price'] - .toString(), - 'Distance': list['distance'] - .toString(), - 'name': list['first_name'] - .toString(), - 'phone': list['phone'] - .toString(), - 'email': list['email'] - .toString(), - 'WalletChecked': - list['payment_method'] - .toString(), - 'tokenPassenger': - list['passengerToken'] - .toString(), - 'direction': - 'https://www.google.com/maps/dir/${list['start_location']}/${list['end_location']}/', - 'DurationToPassenger': - list['duration'] - .toString(), - 'rideId': - list['id'].toString(), - 'passengerId': - list['passenger_id'] - .toString(), - 'driverId': box - .read(BoxName.driverID) - .toString(), - 'durationOfRideValue': - list['duration'] - .toString(), - 'paymentAmount': - list['price'] - .toString(), - 'paymentMethod': - 'cash'.toString() == //todo fix payment method - 'true' - ? 'visa' - : 'cash', - 'isHaveSteps': - 'startEnd'.toString(), - 'step0': ''.toString(), - 'step1': ''.toString(), - 'step2': ''.toString(), - 'step3': ''.toString(), - 'step4': ''.toString(), - 'passengerWalletBurc': - list['bruc'].toString(), - 'timeOfOrder': - DateTime.now() - .toString(), - 'totalPassenger': - list['price'] - .toString(), - 'carType': list['carType'] - .toString(), - 'kazan': Get.find< - HomeCaptainController>() - .kazan - .toString(), - }); - } - }, - kolor: AppColor.greenColor, - ), - Text( - '📍 ${list['distance']} ${'KM'.tr}', - style: AppStyle.title.copyWith( - color: AppColor.greenColor), - ), - ], - ) - ], - ), - ); - }), - ) - ], - isleading: true); - }); - } -} diff --git a/pubspec.lock b/pubspec.lock index e7c314f..27feefc 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -73,14 +73,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.1.18" - background_location: - dependency: "direct main" - description: - name: background_location - sha256: fbb83ceb8cefcc6793f0a362f12773c28fc290a5e2c76cb593ee592ec7b6cb32 - url: "https://pub.dev" - source: hosted - version: "0.13.0" boolean_selector: dependency: transitive description: @@ -298,7 +290,7 @@ packages: source: hosted version: "0.3.3+7" crypto: - dependency: "direct main" + dependency: transitive description: name: crypto sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab @@ -385,14 +377,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.5.2" - equatable: - dependency: transitive - description: - name: equatable - sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 - url: "https://pub.dev" - source: hosted - version: "2.0.5" fake_async: dependency: transitive description: @@ -505,14 +489,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" - fl_chart: - dependency: "direct main" - description: - name: fl_chart - sha256: fe6fec7d85975a99c73b9515a69a6e291364accfa0e4a5b3ce6de814d74b9a1c - url: "https://pub.dev" - source: hosted - version: "0.66.0" flutter: dependency: "direct main" description: flutter @@ -912,22 +888,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.5.4+2" - google_mlkit_commons: - dependency: transitive - description: - name: google_mlkit_commons - sha256: "27d626c66a181351a953eba5b6ff1ff123aadb891b4dab085b292118f039d6ac" - url: "https://pub.dev" - source: hosted - version: "0.7.1" - google_mlkit_text_recognition: - dependency: "direct main" - description: - name: google_mlkit_text_recognition - sha256: "89c848329355f165ff17ca8645cab5998770e9e25e431fe6dd8261ed9cf7bdc4" - url: "https://pub.dev" - source: hosted - version: "0.13.0" google_polyline_algorithm: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index b4b5a76..a63026f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -33,7 +33,6 @@ dependencies: geolocator: ^10.0.0 flutter_paypal: ^0.2.0 flutter_launcher_icons: ^0.13.1 - crypto: ^3.0.3 flutter_rating_bar: ^4.0.1 flutter_font_icons: ^2.2.5 device_info_plus: ^9.1.0 @@ -47,21 +46,18 @@ dependencies: envied: ^0.5.2 cached_network_image: ^3.3.0 calendar_builder: ^0.0.6 - fl_chart: ^0.66.0 agora_rtc_engine: ^6.2.6 flutter_tts: ^3.8.5 permission_handler: ^11.3.0 google_generative_ai: ^0.0.1-dev vibration: ^1.8.4 wakelock_plus: - background_location: ^0.13.0 record: ^5.0.5 dio: ^5.4.3+1 webview_flutter: ^4.7.0 just_audio: ^0.9.37 share: ^2.0.4 google_sign_in: ^6.2.1 - google_mlkit_text_recognition: ^0.13.0 diff --git a/t dataBounds = [] b/t dataBounds = [] deleted file mode 100644 index f81492a..0000000 --- a/t dataBounds = [] +++ /dev/null @@ -1,344 +0,0 @@ -warning: in the working copy of 'linux/flutter/generated_plugin_registrant.cc', LF will be replaced by CRLF the next time Git touches it -warning: in the working copy of 'linux/flutter/generated_plugin_registrant.h', LF will be replaced by CRLF the next time Git touches it -warning: in the working copy of 'linux/flutter/generated_plugins.cmake', LF will be replaced by CRLF the next time Git touches it -warning: in the working copy of 'macos/Flutter/GeneratedPluginRegistrant.swift', LF will be replaced by CRLF the next time Git touches it -warning: in the working copy of 'windows/flutter/generated_plugin_registrant.cc', LF will be replaced by CRLF the next time Git touches it -warning: in the working copy of 'windows/flutter/generated_plugin_registrant.h', LF will be replaced by CRLF the next time Git touches it -warning: in the working copy of 'windows/flutter/generated_plugins.cmake', LF will be replaced by CRLF the next time Git touches it -diff --git a/lib/controller/home/captin/map_driver_controller.dart b/lib/controller/home/captin/map_driver_controller.dart -index 8c72810..34875b4 100644 ---- a/lib/controller/home/captin/map_driver_controller.dart -+++ b/lib/controller/home/captin/map_driver_controller.dart -@@ -226,7 +226,7 @@ class MapDriverController extends GetxController { - }); - rideIsBeginPassengerTimer(); - double pointsSubstraction = 0; -- pointsSubstraction = double.parse(paymentAmount) * -1; -+ pointsSubstraction = double.parse(paymentAmount) * -100; - var res = await CRUD().post(link: AppLink.addDriversWallet, payload: { - 'paymentID': 'rideId$rideId', - 'amount': (pointsSubstraction).toString(), -@@ -429,7 +429,12 @@ class MapDriverController extends GetxController { - width: 10, - color: AppColor.blueColor, - ); -- mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 14)); -+ // final dataBounds = response["routes"][0]["bounds"]; -+ -+ // updateCameraFromBoundsAfterGetMap(dataBounds); -+ -+// Fit the camera to the bounds -+ - polyLines.add(polyline); - // rideConfirm = false; - update(); -@@ -468,13 +473,31 @@ class MapDriverController extends GetxController { - width: 10, - color: AppColor.redColor, - ); -+ // final dataBounds = response["routes"][0]["bounds"]; -  -- polyLinesDestination.add(polyline); -+ // updateCameraFromBoundsAfterGetMap(dataBounds); -+ // polyLinesDestination.add(polyline); - // rideConfirm = false; - update(); - } - } -  -+ void updateCameraFromBoundsAfterGetMap(dynamic response) { -+ final bounds = response["routes"][0]["bounds"]; -+ LatLng northeast = -+ LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']); -+ LatLng southwest = -+ LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']); -+ -+// Create the LatLngBounds object -+ LatLngBounds boundsData = -+ LatLngBounds(northeast: northeast, southwest: southwest); -+ -+// Fit the camera to the bounds -+ var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 140); -+ mapController!.animateCamera(cameraUpdate); -+ } -+ - void changePassengerInfoWindow() { - isPassengerInfoWindow = !isPassengerInfoWindow; - passengerInfoWindow = isPassengerInfoWindow == true ? 200 : 0; -diff --git a/lib/controller/home/map_passenger_controller.dart b/lib/controller/home/map_passenger_controller.dart -index a2d4712..d4adf6f 100644 ---- a/lib/controller/home/map_passenger_controller.dart -+++ b/lib/controller/home/map_passenger_controller.dart -@@ -186,6 +186,7 @@ class MapPassengerController extends GetxController { - late double cost = 0; - late double distance = 0; - late double duration = 0; -+ List dataBounds = []; -  - late Duration durationToAdd; - late DateTime newTime = DateTime.now(); -@@ -218,8 +219,9 @@ class MapPassengerController extends GetxController { - durationToRide = 0; - distanceOfDestnation = 0; - wayPointSheetHeight = 0; -- for (var i = 0; i < Get.find().wayPoints.length; i++) { -- if (placesCoordinate[i + 1].toString() != '') { -+ for (var i = 0; i < placesCoordinate.length; i++) { -+ if (placesCoordinate[i + 1].toString() != '' || -+ placesCoordinate[i + 1].toString() != null) { - await getMapPoints( - placesCoordinate[i].toString(), - placesCoordinate[i + 1].toString(), -@@ -227,7 +229,7 @@ class MapPassengerController extends GetxController { - ); - } - } -- updateCameraForDistanceAfterGetMap(); -+ // updateCameraForDistanceAfterGetMap(); - // isWayPointStopsSheet = false; - if (haveSteps) { - String latestWaypoint = -@@ -378,13 +380,9 @@ class MapPassengerController extends GetxController { - } -  - void sendSMS(String to) async { -- // Get the driver's phone number. -- String driverPhone = -- dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString(); -- - // Format the message. - String message = -- 'Hi! This is ${box.read(BoxName.name)}. I am using ${box.read(AppInformation.appName)} to ride with ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} as the driver. ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} is driving a ${dataCarsLocationByPassenger['message'][carsOrder]['model'].toString()} with license plate ${dataCarsLocationByPassenger['message'][carsOrder]['license_plate'].toString()}. I am currently located at $passengerLocation. If you need to reach me, please contact the driver directly at $driverPhone.'; -+ 'Hi! This is ${box.read(BoxName.name)}.\n I am using ${box.read(AppInformation.appName)} to ride with $firstName as the driver. $firstName \nis driving a $model\n with license plate $licensePlate.\n I am currently located at $passengerLocation.\n If you need to reach me, please contact the driver directly at\n\n $driverPhone .'; -  - // Launch the URL to send the SMS. - launchCommunication('sms', to, message); -@@ -392,12 +390,10 @@ class MapPassengerController extends GetxController { -  - void sendWhatsapp(String to) async { - // Get the driver's phone number. -- String driverPhone = -- dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString(); -  - // Format the message. - String message = -- 'Hi! This is ${box.read(BoxName.name)}.\n I am using ${box.read(AppInformation.appName)} to ride with ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} as the driver. ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} \nis driving a ${dataCarsLocationByPassenger['message'][carsOrder]['model'].toString()}\n with license plate ${dataCarsLocationByPassenger['message'][carsOrder]['license_plate'].toString()}.\n I am currently located at $passengerLocation.\n If you need to reach me, please contact the driver directly at\n\n $driverPhone.'; -+ 'Hi! This is ${box.read(BoxName.name)}.\n I am using ${box.read(AppInformation.appName)} to ride with $firstName as the driver. $firstName \nis driving a $model\n with license plate $licensePlate.\n I am currently located at $passengerLocation.\n If you need to reach me, please contact the driver directly at\n\n $driverPhone .'; -  - // Launch the URL to send the SMS. - launchCommunication('whatsapp', to, message); -@@ -444,6 +440,44 @@ class MapPassengerController extends GetxController { - } - } -  -+ // void startTimerToPassengerFromDriverAfterApplied() async { -+ // for (int i = 0; i <= timeToPassengerFromDriverAfterApplied; i++) { -+ // await Future.delayed(const Duration(seconds: 1)); -+ // progressTimerToPassengerFromDriverAfterApplied = -+ // i / timeToPassengerFromDriverAfterApplied; -+ // remainingTimeToPassengerFromDriverAfterApplied = -+ // timeToPassengerFromDriverAfterApplied - i; -+ -+ // var response = await CRUD().post( -+ // link: AppLink.addAdminUser, ////////change to nnew endpoint -+ // payload: { -+ // 'ride_id': rideId, -+ // 'time_to_passenger_from_driver_after_applied': -+ // timeToPassengerFromDriverAfterApplied, -+ // }); -+ -+ // if (response.statusCode == 200) { -+ // // Update progress and remaining time -+ // int minutes = -+ // (remainingTimeToPassengerFromDriverAfterApplied / 60).floor(); -+ // int seconds = remainingTimeToPassengerFromDriverAfterApplied % 60; -+ // stringRemainingTimeToPassenger = -+ // '$minutes:${seconds.toString().padLeft(2, '0')}'; -+ // update(); -+ -+ // if (remainingTimeToPassengerFromDriverAfterApplied < 69) { -+ // if (rideTimerBegin == false) { -+ // getBeginRideFromDriver(); -+ // } -+ // } -+ // } else { -+ // // Handle error -+ // print( -+ // 'Error updating time to passenger: ${response.statusCode} ${response.reasonPhrase} ${response.body}'); -+ // } -+ // } -+ // } -+ - // Create a StreamController to manage the timer values - final timerController = StreamController(); -  -@@ -579,10 +613,24 @@ class MapPassengerController extends GetxController { - update(); - } -  -+ late String driverPhone; -+ late String firstName; -+ late String model; -+ late String licensePlate; - changeConfirmRide() async { - if (dataCarsLocationByPassenger != 'failure') { - driverToken = - dataCarsLocationByPassenger['message'][carsOrder]['token'].toString(); -+ driverPhone = -+ dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString(); -+ firstName = dataCarsLocationByPassenger['message'][carsOrder] -+ ['first_name'] -+ .toString(); -+ model = -+ dataCarsLocationByPassenger['message'][carsOrder]['model'].toString(); -+ licensePlate = dataCarsLocationByPassenger['message'][carsOrder] -+ ['license_plate'] -+ .toString(); - PaymentController paymentController = Get.find(); - rideConfirm = true; - shouldFetch = true; -@@ -617,9 +665,9 @@ class MapPassengerController extends GetxController { - List body = [ - '${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}', - '${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}', -- totalPassenger.toString(), -+ totalPassenger.toStringAsFixed(2), - totalDriver.toString(), -- duration.toString(), -+ Duration(seconds: durationToRide).toString(), - distance.toString(), - dataCarsLocationByPassenger['message'][carsOrder]['driver_id'] - .toString(), -@@ -1442,23 +1490,29 @@ class MapPassengerController extends GetxController { - double lng = points[i][1].toDouble(); - polylineCoordinates.add(LatLng(lat, lng)); - } -+ newStartPointLocation = LatLng( -+ data[0]["start_location"]['lat'], data[0]["start_location"]['lng']); - // Define the northeast and southwest coordinates - final bounds = response["routes"][0]["bounds"]; -- - LatLng northeast = - LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']); - LatLng southwest = - LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']); -  -- // Create the LatLngBounds object -- boundsData = LatLngBounds(northeast: northeast, southwest: southwest); -+// Create the LatLngBounds object -+ LatLngBounds boundsData = -+ LatLngBounds(northeast: northeast, southwest: southwest); -+ -+// Fit the camera to the bounds -+ var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 130); -+ mapController!.animateCamera(cameraUpdate); -  - // Calculate the zoom level based on the distance and screen size -  - // getDistanceFromText(data[0]['distance']['text']); - double distanceOfTrip = (data[0]['distance']['value']) / 1000; - distance = distanceOfTrip; -- updateCameraForDistanceAfterGetMap(); -+ // updateCameraForDistanceAfterGetMap(); -  - if (polyLines.isNotEmpty) { - clearPolyline(); -@@ -1506,15 +1560,6 @@ class MapPassengerController extends GetxController { - polylineCoordinatesPointsAll[index].add(LatLng(lat, lng)); - } - // Define the northeast and southwest coordinates -- final bounds = response["routes"][0]["bounds"]; -- -- LatLng northeast = -- LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']); -- LatLng southwest = -- LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']); -- -- // Create the LatLngBounds object -- boundsData = LatLngBounds(northeast: northeast, southwest: southwest); -  - if (polyLines.isNotEmpty) { - // clearPolyline(); -@@ -1533,6 +1578,22 @@ class MapPassengerController extends GetxController { - } - } -  -+ void updateCameraFromBoundsAfterGetMap(dynamic response) { -+ final bounds = response["routes"][0]["bounds"]; -+ LatLng northeast = -+ LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']); -+ LatLng southwest = -+ LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']); -+ -+// Create the LatLngBounds object -+ LatLngBounds boundsData = -+ LatLngBounds(northeast: northeast, southwest: southwest); -+ -+// Fit the camera to the bounds -+ var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 140); -+ mapController!.animateCamera(cameraUpdate); -+ } -+ - updateCameraForDistanceAfterGetMap() { - if (distance <= 5) { - mapController! -diff --git a/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart b/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart -index f37bea3..eb5e3a0 100644 ---- a/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart -+++ b/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart -@@ -20,7 +20,7 @@ GetBuilder driverEndRideBar() { - child: Column( - children: [ - Row( -- mainAxisAlignment: MainAxisAlignment.spaceAround, -+ mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Column( - children: [ -@@ -31,15 +31,6 @@ GetBuilder driverEndRideBar() { - ), - ], - ), -- mapDriverController.remainingTimeTimerRideBegin < 60 -- ? MyElevatedButton( -- title: 'End Ride'.tr, -- onPressed: () { -- mapDriverController.finishRideFromDriver(); -- }, -- kolor: AppColor.redColor, -- ) -- : const SizedBox(), - Column( - children: [ - const Icon(Icons.timelapse), -@@ -48,8 +39,30 @@ GetBuilder driverEndRideBar() { - style: AppStyle.title), - ], - ), -+ Column( -+ children: [ -+ const Icon(Icons.money_sharp), -+ Text( -+ '${mapDriverController.paymentAmount} ${'\$'.tr}', -+ style: AppStyle.title), -+ ], -+ ), - ], - ), -+ mapDriverController.remainingTimeTimerRideBegin < 60 -+ ? Row( -+ mainAxisAlignment: MainAxisAlignment.center, -+ children: [ -+ MyElevatedButton( -+ title: 'End Ride'.tr, -+ onPressed: () { -+ mapDriverController.finishRideFromDriver(); -+ }, -+ kolor: AppColor.redColor, -+ ), -+ ], -+ ) -+ : const SizedBox(), - Stack( - children: [ - LinearProgressIndicator(