From dc4677a6bf912d221f0151f9dfaa38d25f6f08ef Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Fri, 5 Jul 2024 04:50:32 +0300 Subject: [PATCH] 7/5/1 --- .env | 44 ++++ android/app/build.gradle | 4 +- lib/constant/api_key.dart | 71 ++++++ lib/constant/links.dart | 2 + .../auth/captin/login_captin_controller.dart | 5 +- .../captin/register_captin_controller.dart | 8 +- lib/controller/auth/google_sign.dart | 5 +- lib/controller/firebase/firbase_messge.dart | 10 +- lib/controller/functions/crud.dart | 3 + lib/controller/functions/encrypt.dart | 83 +++++++ lib/controller/functions/gemeni.dart | 235 ++++++++++++------ .../home/captin/order_request_controller.dart | 27 ++ lib/controller/local/translations.dart | 20 +- lib/controller/rate/rate_conroller.dart | 4 +- .../auth/captin/cards/egypt_card_a_i.dart | 2 +- .../widget/left_menu_map_captain.dart | 42 +++- .../passenger_info_window.dart | 22 +- .../orderCaptin/order_request_page.dart | 169 ++++++------- .../orderCaptin/order_speed_request.dart | 47 ++-- pubspec.lock | 16 ++ pubspec.yaml | 1 + 21 files changed, 586 insertions(+), 234 deletions(-) create mode 100644 lib/controller/functions/encrypt.dart diff --git a/.env b/.env index 2b55c08..c85714a 100644 --- a/.env +++ b/.env @@ -39,3 +39,47 @@ payMobOutClientSecrret='xyjjRlahJM0Xc38WjApCOh8bvgL9slFpNdM9YeCu9AhLqboKMPtmSvc2 payMobOutClient_id='Z05ut48dVkS2gI2zenFFcKsfDKfHAU0WELqKyJ0LXrXlBl' payMobOutPassword='D2zJFxkE#LN3vz38z2dYxpNfWXrXlBl' payMobOutUserName='zjujl_qvo_fwjfgjlXrXlBl' + + +# +#basicAuthCredentials= q9XDwNb2SWHU9nq0tIqWYIN+bvXt54jPVrBFOZUstsnk3Ndz2BOSI3wLC3GKMuqE +#basicCompareFaces= ZK2RkvTEAi0ihtR0GuJ+H2bmU1OVn5V/f9NLVoKZZdE= +#basicCompareFacesURL= ar0jvB0naim05FOurHErUfYAeinsHtAN899iUikg7tbJr+6xxOGCuKWOCHe5IvhNgCGRu0J93Kp81vuPDx4unmHE09ltyI+q6VxB/MS7qzc= +#accountSIDTwillo= Jg38nDPhemTsfLr6Lw/2FkBqXpgwsDREDKNZz4dFX8ZlhfR+c4SfLJw+5Kc9eCw9VIFDaAuONiCxy4EFZlTuDg== +#serverAPI= ylOIFlS8ojjZXo/KU+c9XfElPMf81wsrXfbJffd2vY8BIoAA+KPEgln5nhZm/NAChi96Fq/hxqX5OJM4oWFR0WhMwfMIP5kwdoHWtoJnaYDhyvLeEopljDHXxlMmavnzYmJPDJFO7RYC9bOZO/7ce9j5r9OApZFHCRE3xEiT11rvnc11nAS6FUND+DSqHixBpgRpaGzT6oI7V+/s/vY9UYyv1/87NDJCQcRdwqGNVxw= +#mapAPIKEY= tGW+KMGKtB6WNfuREjWHd1XT7O62xtleFECqMAAlugDro1IAeTZIulIQ3E8VZpWTdrY9VaxsP9HWpquGgn3FDw== +#twilloRecoveryCode= avovNMV1kWHcJCvEDCo2JB3YFuh7k7jFO/mQl9RPIf2dcqWYLgXlQJgYb1py7iMf +#authTokenTwillo= yX+P/HtnhF/zXqiR6dTmCNJkKqueZ/w6tRsj5shUtxmuvImHIFipy9Ncui4xDJ3qWYqpTJtK2E1s2MK0v4Ffng== +#chatGPTkey= eEFPdATgADNXrFigOePxRbJMcD+6WnO0p50QwNbTX42VarY2dSXKHZ7Vc0PlnSbvLTbYcmkeUKkOiZYh/t0gYP7heniFJ7CmGz50zvCbfAU= +#transactionCloude= fK6CI/ZhL5LrOdIm3l9JfStKlUYm1XcuFG/QYht8UeiNamZnRp4UsjUzs4+HNClOGsE5sGht3T6QMnE65e4lwwtBsXaDm+0Dlb6AcA6rMC8= +#visionApi= dXV9rtlwEBg7TrXCmPIc395+jpxaw/258dEBNfFUfbVQuJP+kWnFdzNzIyzFwjIGDAIgoE95uynR2/eNJOTY0A== +#chatGPTkeySefer= 2ZEe3pK2HOWRtEzTB7FjODCbB954UNnvb/L2x3lKsc9NCILNzgCffzcdqEzPs+lHCeolKViweygvgR7fIwC6z3cJJap7t+SPQ1noP5i2pRg= +#chatGPTkeySeferNew= KtZfNq+kEbVjU4eZVl+aexBKNybgr8jQvz/CZJQcH/CebLeFdkdfkJx43QA7UtH8oNH2hLTcrtqSKAXT0wYwShEG+Gt8pvgCx8xT+ViQrTE= +#secretKey= PNwYqtlLcDMlmKbzy3++wSPC/XB9WX2t+zfrJDsYz7LXD5jVFUGs3CXUF227VDGPe1sk10yMGLM4E818969GF7/qhZjLzwF8qXLAEpUhtGniQ+undfoiJw2vNfB4lXWKgQQC4N+/6KPb7zSZx8o8yVlvL/5iZiuf1LYhUhjJmJE= +#stripe_publishableKe= gyXxuOp+vaGcRTTBohZeTaK7HEhpNUVvWGcBNABhzHu125y6ftOwvf1Z8fYlfaG/ysClJpqfxBU8+RulI7KhtJM5mVrmALFiypv/6IlkACsundM6zkbxQGHzjfQdrfkdFZF00fpYjOI/3P/znZIlKGYYLmdxUqF3chAfYDet1/I= +#llamaKey= a3oCdxMeaKjatKyLQEnPMLqFmfLe9mCGRofsROVQ6NF7SCqxOt7h2A/KvdYWGBM42SxNTuWIq5+UsnPulqKbd3yVTRnG+Lx0rxPa+9mc48frICnl+hz6CSmJjOjDhHnE +#serverPHP= blf8gn/gV8/mvMZlPdJMnSu+ATBZfBThpVjNb9mzXT7OfBrBSZnCBxveUsCcXUW3 +#cohere= SvRbfrRc+Gyyy20otHDz1cNNcQpoMyLm+TIkTyfZI7vnxkgsEYiGdYOJ0Punkz6JdY4qa3B0fu2OCZ7NOa6Y1w== +#claudeAiAPI= oO1ZcIFPBgin9gQs5vNT/oDs0KpJDVnjwXqKjCAABoezFxLUpAMINvSNruW7DFU2mbsjpJTDwpTzddsMCIPqi7AjzBpW6X1ddxYX+ZPuJ55Kymj5KvTHAwYYhW7F3l9sOjrtODWwhH6uGTNfh3Ftz531Xb2Qr5d3rKDC4H5tkFM= +#payPalClientId= VmMsEn1Kz4wCqCnWOm+XoUE2k2c7wA9y2cHqe303GSR9HfnuDqpbcijBYDs5EGYsYF/t68M1xlAp1OX+oXSN3RSsjKelJmbbreg8YtjTeErMVOSGHrsOHRY7hqlUYvmN8DUTlRTFvIdTX+RafY2LiA== +#payPalClientIdLive= qA7WnFU1WANkp1tFx/FsAQg11xw3MT9+29KiviNZ4/CJZ8HjXA1oaiXP9jFCdw9O5lIsxu77kwcHyyj7jazRo40gHt09LOiQx3B9TGyYU8xZKyrTgDYzaAN8uGtzh+im+O3uX9e8dB6hP3KjoEiWAw== +#payPalSecret= /X5bZua3pBhTWc+lM0Soj0B9DmZCAd7d6ptl7Odqvl6VM2WXsxLTEj+quzlqWsw5EMohotzv+vsgOaak7MnSFj/GiH3dsLrCDKRbKmMtO8B7y01sTxHM5KJBThdn00kdPhCrRupHGBQ2UVn7+Pvk+g== +#payPalSecretLive= IgD5ztFUiGNpKNn9tQ1BUrxJixFEa6qOD2rTlrMHWddgEFJfSnwguYk+ims2Fjh/Yyq6k7blq3rNw8QxvqYx8Zddn3JBkjJy+CuCO8PD87yE3Cq16lAYpKBUONx1L2JhfOvnpHmlKsItNp3VlO2hnA== +#geminiApi= bm0hPbzgZ4fYIiQIt+q01JMoinEwOanaTTP+w6VVa5ycvURUWzRNUGuxkw8SddBODHMsmw3m6QMDhWRV2JldWQ== +#geminiApiMasa= NivzPDHz8vLzsd+1NlCTdr7z0Q7QF20nXv64sc31KV5itWz+jy/wXfJKBk3FUkGws0ASOiO3bPcsS4ZpTDt/Gg== +#agoraAppId= VFN6+inSX0lGchoJJyyregcmoz7IRc4WFIvY0E7DSoSMOWy87h64PplAeR5gb0bdsSdBoNlKHVMqdiAiHf6rAA== +#agoraAppCertificate= K5mK/SbgSybbq1n8T8fwDjg+KTCBHaXFztmslJ6IVuEol+rAGhPN3i9zsvtQrHbKzhEQPvCL4Bga0UL9qAVZFA== +#usernamePayMob= RB5cSc0HLCKF47EJQgq+9aGwjc9M6aCBV/gC0h/f+gY= +#passwordPayMob= WDGpip/MF/k8K2bq+A6GYP40z9JrCkzMx5V6J+lzJ6Q= +#integrationIdPayMob= R1xVYlVQwYslnZ9J7XSgcguCuQSJalFSlBNnVP6mMbE= +#payMobApikey= g3vzSYRbIw9WOB+d48x5mt3CGMfGuuH8zFL6ane7b8mi8k2Jx571o3/3A93bAMj9cdW8yY0a1z1zgjqHoPNbBWhr5G4P5EySachi05ZQ5c25zXi/hO1RgNF9lA4+d5l4vpOqkNqglAD+t940Fg3Pa5UC5qhQNwsAz6OMFpRZoD87vdPRqX2ovzGnXy5OuljFuU0NO7tswQ7ECgZAROT5zGQQRksjbhjay3hrngENl6XUsdY8OczkBeKSkXD8T7RGKmsUDnn0C14N7ag8mCPponfs1+DvfG5jl5tYTCX07E4suvwbnx6rRrJXX8BrlC4u9f1ZPwjOJr1CVaWzxcOMLe4/FNhbqC93rBs1SB3zWYS8wjd+YD+Yzyhew2g0yodZ +#integrationIdPayMobWallet= dFjz/piJiilWVXHtZveA0wgU7d7evsQ9WhPsCTwFkT8= +#ocpApimSubscriptionKey= xg4WM1WHVuPBRV9W7xLC0TFRhjgnFuvXBIRddkWcIl7gJAoexceuFlHN7472eL9ZMs6xetYgAHkjsb95QBoF/g== +#smsPasswordEgypt= uvn2Wnr+Ze35cXGfznnb7Rjy+35y6ti38m4E5QA+6h8= +#chatGPTkeySeferNew4= /HJYg55+KIoHpEPH6yEULOm4lUs3fPsgPInSeq5z0PDmJOXqrkPMNKkr8BcmHeuvZE3OYWTiLkGlNThiMpTmXTgMFZtjTPLLRw/Ubcu/aCU= +#anthropicAIkeySeferNew= ELDX2kXW5wnEDEA7K+Wfhi6Tp98MyckswWQHpc2VqEh9XhethhxjemkyqqQ8U2QiTbI00MjlM+BGz0/Y0o1y/LTkzrPwLCaxxxi9m5F58vDukDoeRvFykeNVC1rXiwj5Ew7GU1z1SX05mQ8Iz7s9dv094Ix8qfv9I5GZs8oh14k= +#llama3Key= tK+3v5cmkZ5X9mTyrEl+GscVweQKXm12c6fEUCJJ1hfd0oODKViaQr47Ta06eBrSBVy5KcXmjpHMKAAJl/AT9hofexIqQx4mwBs2pzaGEII= +#payMobOutClientSecrret= Y4QJnSAUYwWYPOcpfUI57vXFrn6uSc0sAk1IPkEVxjcoKGhyHZmtQW9yzgTWzpwkX6SxPtryC5tN7lP5CatIAytRqN/l00SGJpz1k4JezuW6o8UiGTvrVXxkObxQup2elF5hobG1/HgQ96pyR1447GtlcJ74rGeDqQXbC+utvpFsoLHYpB42MFCRtapUx5/4SBuJNWjmK0Wbj3gnx3GoPQ== +#payMobOutClient_id= rtUDCUWMAntRHxcDwmuvE62z7ZCy/AUsfYmotuhHKjG+4Q5woRNIvtm4jwRG0IYUYX2e8xEbDDfnGr4B5AT9pQ== +#payMobOutPassword= EnF8QHZxcAzLxi/OSjl8G9hUof0taNLgiKWAB8ElY7ZSWzrBUcpiO71+oD9hAjHL +#payMobOutUserName= PP3va1/KdbA42xHGN+qkN4J90E3icYbHVhgKX/nKoMEwhjwjB7W2ehy+bfN+ggj1 \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index 46bed1e..7c1dc7b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -55,8 +55,8 @@ android { // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdkVersion 23 targetSdkVersion 33 - versionCode 47 - versionName '1.5.47' + versionCode 48 + versionName '1.5.48' // manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml'] } diff --git a/lib/constant/api_key.dart b/lib/constant/api_key.dart index d49b40b..107c070 100644 --- a/lib/constant/api_key.dart +++ b/lib/constant/api_key.dart @@ -69,3 +69,74 @@ class AK { static final String payMobOutUserName = a.r(a.r(a.r(Env.payMobOutUserName, cn), cC), cs); } + +// +// import '../controller/functions/encrypt.dart'; +// import '../env/env.dart'; +// import 'char_map.dart'; +// import 'credential.dart'; +// +// class AK { +// static final AC a = AC(); +// static final String publishableKey = +// KeyEncryption.decryptKey(Env.stripePublishableKe); +// static final String secretKey = KeyEncryption.decryptKey(Env.secretKey); +// static final String basicAuthCredentials = +// KeyEncryption.decryptKey(Env.basicAuthCredentials); +// static final String accountSIDTwillo = +// KeyEncryption.decryptKey(Env.accountSIDTwillo); +// static final String serverAPI = KeyEncryption.decryptKey(Env.serverAPI); +// static final String mapAPIKEY = KeyEncryption.decryptKey(Env.mapAPIKEY); +// static final String twilloRecoveryCode = +// KeyEncryption.decryptKey(Env.twilloRecoveryCode); +// static final String authTokenTwillo = +// KeyEncryption.decryptKey(Env.authTokenTwillo); +// static final String chatGPTkey = KeyEncryption.decryptKey(Env.chatGPTkey); +// static final String transactionCloude = +// KeyEncryption.decryptKey(Env.transactionCloude); +// static final String visionApi = KeyEncryption.decryptKey(Env.visionApi); +// static final String chatGPTkeySefer = +// KeyEncryption.decryptKey(Env.chatGPTkeySefer); +// static final String chatGPTkeySeferNew = +// KeyEncryption.decryptKey(Env.chatGPTkeySeferNew); +// static final String serverPHP = Env.serverPHP; +// static final String llamaKey = KeyEncryption.decryptKey(Env.llamaKey); +// static final String cohere = KeyEncryption.decryptKey(Env.cohere); +// static final String claudeAiAPI = KeyEncryption.decryptKey(Env.claudeAiAPI); +// static final String payPalClientId = +// KeyEncryption.decryptKey(Env.payPalClientId); +// static final String payPalSecret = KeyEncryption.decryptKey(Env.payPalSecret); +// static final String geminiApi = KeyEncryption.decryptKey(Env.geminiApi); +// static final String agoraAppId = KeyEncryption.decryptKey(Env.agoraAppId); +// static final String agoraAppCertificate = +// KeyEncryption.decryptKey(Env.agoraAppCertificate); +// static final String payPalClientIdLive = +// KeyEncryption.decryptKey(Env.payPalClientIdLive); +// static final String payPalSecretLive = +// KeyEncryption.decryptKey(Env.payPalSecretLive); +// static final String integrationIdPayMob = +// KeyEncryption.decryptKey(Env.integrationIdPayMob); +// static final String passwordPayMob = +// KeyEncryption.decryptKey(Env.passwordPayMob); +// static final String usernamePayMob = +// KeyEncryption.decryptKey(Env.usernamePayMob); +// static final String payMobApikey = KeyEncryption.decryptKey(Env.payMobApikey); +// static final String integrationIdPayMobWallet = +// KeyEncryption.decryptKey(Env.integrationIdPayMobWallet); +// static final String smsPasswordEgypt = +// KeyEncryption.decryptKey(Env.smsPasswordEgypt); +// static final String ocpApimSubscriptionKey = Env.ocpApimSubscriptionKey; +// static final String chatGPTkeySeferNew4 = +// KeyEncryption.decryptKey(Env.chatGPTkeySeferNew4); +// static final String anthropicAIkeySeferNew = +// KeyEncryption.decryptKey(Env.anthropicAIkeySeferNew); +// static final String llama3Key = KeyEncryption.decryptKey(Env.llama3Key); +// static final String payMobOutClientSecrret = +// KeyEncryption.decryptKey(Env.payMobOutClientSecrret); +// static final String payMobOutClient_id = +// KeyEncryption.decryptKey(Env.payMobOutClient_id); +// static final String payMobOutPassword = +// KeyEncryption.decryptKey(Env.payMobOutPassword); +// static final String payMobOutUserName = +// KeyEncryption.decryptKey(Env.payMobOutUserName); +// } diff --git a/lib/constant/links.dart b/lib/constant/links.dart index 58ffee1..71b7f12 100644 --- a/lib/constant/links.dart +++ b/lib/constant/links.dart @@ -58,6 +58,8 @@ class AppLink { static String getRideStatusFromStartApp = "$ride/rides/getRideStatusFromStartApp.php"; static String updateRides = "$ride/rides/update.php"; + static String updateRideAndCheckIfApplied = + "$ride/rides/updateRideAndCheckIfApplied.php"; static String updateStausFromSpeed = "$ride/rides/updateStausFromSpeed.php"; static String deleteRides = "$ride/rides/delete.php"; diff --git a/lib/controller/auth/captin/login_captin_controller.dart b/lib/controller/auth/captin/login_captin_controller.dart index 8e8d17c..4418812 100644 --- a/lib/controller/auth/captin/login_captin_controller.dart +++ b/lib/controller/auth/captin/login_captin_controller.dart @@ -57,9 +57,10 @@ class LoginDriverController extends GetxController { 'email': email, 'id': driverID, }); + print(res); if (res == 'Failure') { //Failure - if (box.read(BoxName.phoneVerified) == '1') { + if (box.read(BoxName.phoneVerified).toString() == '1') { Get.offAll(() => EgyptCardAI()); } else { Get.offAll(() => SmsSignupEgypt()); @@ -72,7 +73,7 @@ class LoginDriverController extends GetxController { var jsonDecoeded = jsonDecode(res); if (jsonDecoeded.isNotEmpty) { if (jsonDecoeded['status'] == 'success' && - jsonDecoeded['data'][0]['is_verified'] == 1) { + jsonDecoeded['data'][0]['is_verified'].toString() == '1') { box.write(BoxName.emailDriver, jsonDecoeded['data'][0]['email']); box.write(BoxName.gender, jsonDecoeded['data'][0]['gender']); box.write(BoxName.phoneVerified, diff --git a/lib/controller/auth/captin/register_captin_controller.dart b/lib/controller/auth/captin/register_captin_controller.dart index 44dc978..ece4c79 100644 --- a/lib/controller/auth/captin/register_captin_controller.dart +++ b/lib/controller/auth/captin/register_captin_controller.dart @@ -109,13 +109,17 @@ class RegisterCaptainController extends GetxController { if (res != 'failure') { // var dec = jsonDecode(res); box.write(BoxName.phoneDriver, '+2${phoneController.text}'); - box.write(BoxName.phoneVerified, 1); + box.write(BoxName.phoneVerified, '1'); // var res1 = await CRUD().post( // link: AppLink.updateAccountBank, // payload: {'phone': '+2${phoneController.text}'}); // if (res1 != 'failure') { - Get.to(EgyptCardAI()); + await Get.put(LoginDriverController()).loginUsingCredentials( + box.read(BoxName.driverID).toString(), + box.read(BoxName.emailDriver).toString(), + ); + // Get.to(EgyptCardAI()); // } else { // Get.snackbar('title', 'message'); // } diff --git a/lib/controller/auth/google_sign.dart b/lib/controller/auth/google_sign.dart index 8b05e46..9209dde 100644 --- a/lib/controller/auth/google_sign.dart +++ b/lib/controller/auth/google_sign.dart @@ -98,7 +98,10 @@ class GoogleSignInHelper { box.write(BoxName.emailDriver, user.email); // box.write(BoxName.nameDriver, user.displayName); // box.write(BoxName.driverPhotoUrl, user.photoUrl); - + print(box.read(BoxName.driverID).toString()); + print( + box.read(BoxName.emailDriver).toString(), + ); // Perform any additional sign-up tasks or API calls here // For example, you can send the user data to your server for registration } diff --git a/lib/controller/firebase/firbase_messge.dart b/lib/controller/firebase/firbase_messge.dart index 87b0c21..b4d2440 100644 --- a/lib/controller/firebase/firbase_messge.dart +++ b/lib/controller/firebase/firbase_messge.dart @@ -109,22 +109,22 @@ class FirebaseMessagesController extends GetxController { // 'PolylineJson': myPoints, 'body': message.notification!.body }); - } else if (message.notification!.title == 'Cancel Trip'.tr) { + } else if (message.notification!.title == 'Cancel Trip') { NotificationController().showNotification( 'Cancel Trip'.tr, 'Passenger Cancel Trip'.tr, 'cancel'); cancelTripDialog(); - } else if (message.notification!.title! == 'token change'.tr) { + } else if (message.notification!.title! == 'token change') { // NotificationController() // .showNotification('token change'.tr, 'token change', 'cancel'); // GoogleSignInHelper.signOut(); GoogleSignInHelper.signOut(); - } else if (message.notification!.title! == 'message From passenger'.tr) { + } else if (message.notification!.title! == 'message From passenger') { NotificationController() - .showNotification('message From passenger'.tr, ''.tr, 'tone2'); + .showNotification('message From passenger', ''.tr, 'tone2'); passengerDialog(message.notification!.body!); update(); - } else if (message.notification!.title! == 'Hi ,I will go now'.tr) { + } else if (message.notification!.title! == 'Hi ,I will go now') { // Get.snackbar('Hi ,I will go now', '', // backgroundColor: AppColor.greenColor); NotificationController().showNotification( diff --git a/lib/controller/functions/crud.dart b/lib/controller/functions/crud.dart index e9a7327..984b88b 100644 --- a/lib/controller/functions/crud.dart +++ b/lib/controller/functions/crud.dart @@ -27,6 +27,9 @@ class CRUD { 'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}', }, ); + print(response.request); + print(response.body); + print(response.statusCode); // if (response.statusCode == 200) { var jsonData = jsonDecode(response.body); if (jsonData['status'] == 'success') { diff --git a/lib/controller/functions/encrypt.dart b/lib/controller/functions/encrypt.dart new file mode 100644 index 0000000..5e97aa5 --- /dev/null +++ b/lib/controller/functions/encrypt.dart @@ -0,0 +1,83 @@ +import 'package:encrypt/encrypt.dart' as encrypt; +import 'dart:convert'; +import 'package:http/http.dart' as http; + +// +import 'dart:convert'; +import 'dart:math'; +import 'package:encrypt/encrypt.dart' as encrypt; + +class KeyEncryption { + static final _key = encrypt.Key.fromUtf8('mehmetDEV@2101'); // ضع مفتاحك هنا + + static String encryptKey(String key) { + final iv = encrypt.IV.fromLength(16); // توليد تهيئة عشوائية + final encrypter = + encrypt.Encrypter(encrypt.AES(_key, mode: encrypt.AESMode.cbc)); + final encrypted = encrypter.encrypt(key, iv: iv); + final result = iv.bytes + encrypted.bytes; // تضمين التهيئة مع النص المشفر + return base64Encode(result); + } + + static String decryptKey(String encryptedKey) { + final decoded = base64Decode(encryptedKey); + final iv = encrypt.IV(decoded.sublist(0, 16)); // استخراج التهيئة + final encrypted = + encrypt.Encrypted(decoded.sublist(16)); // استخراج النص المشفر + final encrypter = + encrypt.Encrypter(encrypt.AES(_key, mode: encrypt.AESMode.cbc)); + return encrypter.decrypt(encrypted, iv: iv); + } +} + +// class KeyEncryption { +// static final _key = encrypt.Key.fromUtf8('7'); // ضع مفتاحك هنا +// +// static String encryptKey(String key) { +// final iv = encrypt.IV.fromLength(16); // توليد تهيئة عشوائية +// final encrypter = +// encrypt.Encrypter(encrypt.AES(_key, mode: encrypt.AESMode.cbc)); +// final encrypted = encrypter.encrypt(key, iv: iv); +// final result = iv.bytes + encrypted.bytes; // تضمين التهيئة مع النص المشفر +// return base64Encode(result); +// } +// +// static String decryptKey(String encryptedKey) { +// final decoded = base64Decode(encryptedKey); +// final iv = encrypt.IV(decoded.sublist(0, 16)); // استخراج التهيئة +// final encrypted = +// encrypt.Encrypted(decoded.sublist(16)); // استخراج النص المشفر +// final encrypter = +// encrypt.Encrypter(encrypt.AES(_key, mode: encrypt.AESMode.cbc)); +// return encrypter.decrypt(encrypted, iv: iv); +// } +// } + +// class KeyEncryption { +// static final _key = +// encrypt.Key.fromUtf8('32-character-key....'); // ضع مفتاحك هنا +// +// static String encryptKey(String key) { +// final iv = encrypt.IV.fromLength(16); // توليد تهيئة عشوائية +// final encrypter = +// encrypt.Encrypter(encrypt.AES(_key, mode: encrypt.AESMode.cbc)); +// final encrypted = encrypter.encrypt(key, iv: iv); +// final result = iv.bytes + encrypted.bytes; // تضمين التهيئة مع النص المشفر +// return base64Encode(result); +// } +// +// static Future storeApiKeys(List apiKeys) async { +// final encryptedKeys = apiKeys.map((key) => encryptKey(key)).toList(); +// final response = await http.post( +// Uri.parse('https://yourdomain.com/store_keys.php'), +// body: jsonEncode({'keys': encryptedKeys}), +// headers: {'Content-Type': 'application/json'}, +// ); +// +// if (response.statusCode == 200) { +// print('Keys stored successfully.'); +// } else { +// print('Failed to store keys.'); +// } +// } +// } diff --git a/lib/controller/functions/gemeni.dart b/lib/controller/functions/gemeni.dart index f7b1ea0..c959c58 100644 --- a/lib/controller/functions/gemeni.dart +++ b/lib/controller/functions/gemeni.dart @@ -201,7 +201,7 @@ class AI extends GetxController { if (isCarSaved && isDriverSaved) { DeviceController().getDeviceSerialNumber(); - box.write(BoxName.phoneVerified, 1); + box.write(BoxName.phoneVerified, '1'); Get.offAll(() => HomeCaptain()); // Get.offAll(() => HomeCaptain()); } @@ -209,89 +209,164 @@ class AI extends GetxController { } Future addDriverEgypt() async { - try { - // Extract values from box or set defaults - var firstName = responseIdEgyptDriverLicense['firstName'] ?? ''; - var lastName = responseIdEgyptDriverLicense['lastName'] ?? ''; - var email = box.read(BoxName.emailDriver) ?? ''; - var phone = box.read(BoxName.phoneDriver)?.toString() ?? ''; - var driverId = box.read(BoxName.driverID)?.toString() ?? ''; - var password = '123456'; - var gender = responseIdEgyptBack['gender'] == 'ذكر' ? 'Male' : 'Female'; - var licenseType = responseIdEgyptDriverLicense['license_type'] ?? ''; - var nationalNumber = responseIdEgyptBack['nationalID'] ?? ''; - var nameArabic = responseIdEgyptDriverLicense['name_arabic'] ?? ''; - var nameEnglish = responseIdEgyptDriverLicense['name_english'] ?? ''; - var issueDate = responseIdEgyptDriverLicense['issue_date'] ?? ''; - var expiryDate = responseIdEgyptDriverLicense['expiry_date'] ?? ''; - var licenseCategories = - responseIdEgyptDriverLicense['license_categories'] ?? ''; - var address = responseIdEgyptFront['address'] ?? ''; - var cardId = responseIdEgyptFront['card_id'] ?? ''; - var occupation = responseIdEgyptBack['occupation'] ?? ''; - var education = responseIdEgyptBack['occupation'] ?? ''; - var licenseIssueDate = - responseIdEgyptDriverLicense['issue_date'].toString() ?? ''; - var religion = responseIdEgyptBack['religion'] ?? ''; - var status = responseIdEgyptBack['fullName'] ?? ''; - var birthdate = responseIdEgyptFront['dob'] != null - ? DateTime.parse(responseIdEgyptFront['dob'] + '-01-01').toString() - : '1960-01-01'; + isLoading = true; + update(); - var maritalStatus = responseIdEgyptBack['maritalStatus'] ?? ''; - var site = responseIdEgyptDriverLicense['address'] ?? ''; - var employmentType = responseIdEgyptDriverLicense['employmentType'] ?? ''; - - // Create payload - var payload = { - 'first_name': firstName, - 'last_name': lastName, - 'email': email, - 'phone': phone, - 'id': driverId, - 'password': password, - 'gender': gender, - 'license_type': licenseType, - 'national_number': nationalNumber, - 'name_arabic': nameArabic, - 'name_english': nameEnglish, - 'issue_date': issueDate, - 'expiry_date': expiryDate, - 'license_categories': licenseCategories, - 'address': address, - 'card_id': cardId, - 'occupation': occupation, - 'education': education, - 'licenseIssueDate': licenseIssueDate, - 'religion': religion, - 'status': status, - 'birthdate': birthdate, - 'maritalStatus': maritalStatus, - 'site': site, - 'employmentType': employmentType, - }; - isLoading = true; - update(); - // Make POST request - var res = await CRUD().post(link: AppLink.signUpCaptin, payload: payload); - var status1 = jsonDecode(res); - isLoading = false; - update(); - // Handle response - - if (status1['status'] == 'success') { - isDriverSaved = true; - Get.snackbar('Success', 'Driver data saved successfully', - backgroundColor: AppColor.greenColor); - } else { - Get.snackbar('Error', 'Failed to save driver data', - backgroundColor: Colors.red); - } - } catch (e) { - Get.snackbar('Error', 'An error occurred while saving driver data', + var payload = { + 'first_name': responseIdEgyptDriverLicense['firstName']?.toString() ?? + 'Not specified', + 'last_name': responseIdEgyptDriverLicense['lastName']?.toString() ?? + 'Not specified', + 'email': box.read(BoxName.emailDriver)?.toString() ?? 'Not specified', + 'phone': box.read(BoxName.phoneDriver)?.toString() ?? 'Not specified', + 'id': box.read(BoxName.driverID)?.toString() ?? 'Not specified', + 'password': '123456', + 'gender': responseIdEgyptBack['gender']?.toString() ?? 'Not specified', + 'license_type': + responseIdEgyptDriverLicense['license_type']?.toString() ?? + 'Not specified', + 'national_number': + responseIdEgyptBack['nationalID']?.toString() ?? 'Not specified', + 'name_arabic': responseIdEgyptDriverLicense['name_arabic']?.toString() ?? + 'Not specified', + 'name_english': + responseIdEgyptDriverLicense['name_english']?.toString() ?? + 'Not specified', + 'issue_date': responseIdEgyptDriverLicense['issue_date']?.toString() ?? + 'Not specified', + 'expiry_date': responseIdEgyptDriverLicense['expiry_date']?.toString() ?? + 'Not specified', + 'license_categories': responseIdEgyptDriverLicense['license_categories'] + is List + ? responseIdEgyptDriverLicense['license_categories'].join(', ') + : responseIdEgyptDriverLicense['license_categories']?.toString() ?? + 'Not specified', + 'address': responseIdEgyptFront['address']?.toString() ?? 'Not specified', + 'card_id': responseIdEgyptFront['card_id']?.toString() ?? 'Not specified', + 'occupation': + responseIdEgyptBack['occupation']?.toString() ?? 'Not specified', + 'education': + responseIdEgyptBack['occupation']?.toString() ?? 'Not specified', + 'licenseIssueDate': + responseIdEgyptDriverLicense['issue_date']?.toString() ?? + 'Not specified', + 'religion': + responseIdEgyptBack['religion']?.toString() ?? 'Not specified', + 'status': 'yet', + 'birthdate': responseIdEgyptFront['dob']?.toString() ?? 'Not specified', + 'maritalStatus': + responseIdEgyptBack['maritalStatus']?.toString() ?? 'Not specified', + 'site': responseIdEgyptDriverLicense['address']?.toString() ?? + 'Not specified', + 'employmentType': + responseIdEgyptDriverLicense['employmentType']?.toString() ?? + 'Not specified', + }; + var res = await CRUD().post(link: AppLink.signUpCaptin, payload: payload); + var status1 = jsonDecode(res); + isLoading = false; + update(); + print(res); + // Handle response + if (status1['status'] == 'success') { + isDriverSaved = true; + Get.snackbar('Success', 'Driver data saved successfully', + backgroundColor: AppColor.greenColor); + } else { + Get.snackbar('Error', 'Failed to save driver data', backgroundColor: Colors.red); } + // } catch (e) { + // isLoading = false; + // update(); + // Get.snackbar('Error', 'An error occurred while saving driver data: $e', + // backgroundColor: Colors.red); + // } } + // Future addDriverEgypt() async { + // // try { + // // Extract values from box or set defaults + // var firstName = responseIdEgyptDriverLicense['firstName'] ?? ''; + // var lastName = responseIdEgyptDriverLicense['lastName'] ?? ''; + // var email = box.read(BoxName.emailDriver) ?? ''; + // var phone = box.read(BoxName.phoneDriver)?.toString() ?? ''; + // var driverId = box.read(BoxName.driverID)?.toString() ?? ''; + // var password = '123456'; + // var gender = responseIdEgyptBack['gender'] == 'ذكر' ? 'Male' : 'Female'; + // var licenseType = responseIdEgyptDriverLicense['license_type'] ?? ''; + // var nationalNumber = responseIdEgyptBack['nationalID'] ?? ''; + // var nameArabic = responseIdEgyptDriverLicense['name_arabic'] ?? ''; + // var nameEnglish = responseIdEgyptDriverLicense['name_english'] ?? ''; + // var issueDate = responseIdEgyptDriverLicense['issue_date'] ?? ''; + // var expiryDate = responseIdEgyptDriverLicense['expiry_date'] ?? ''; + // var licenseCategories = + // responseIdEgyptDriverLicense['license_categories'] ?? ''; + // var address = responseIdEgyptFront['address'] ?? ''; + // var cardId = responseIdEgyptFront['card_id'] ?? ''; + // var occupation = responseIdEgyptBack['occupation'] ?? ''; + // var education = responseIdEgyptBack['occupation'] ?? ''; + // var licenseIssueDate = + // responseIdEgyptDriverLicense['issue_date'].toString() ?? ''; + // var religion = responseIdEgyptBack['religion'] ?? ''; + // var status = responseIdEgyptBack['fullName'] ?? ''; + // var birthdate = responseIdEgyptFront['dob'] != null + // ? DateTime.parse(responseIdEgyptFront['dob'] + '-01-01').toString() + // : '1960-01-01'; + // + // var maritalStatus = responseIdEgyptBack['maritalStatus'] ?? ''; + // var site = responseIdEgyptDriverLicense['address'] ?? ''; + // var employmentType = responseIdEgyptDriverLicense['employmentType'] ?? ''; + // + // // Create payload + // var payload = { + // 'first_name': firstName, + // 'last_name': lastName, + // 'email': email, + // 'phone': phone, + // 'id': driverId, + // 'password': password, + // 'gender': gender, + // 'license_type': licenseType, + // 'national_number': nationalNumber, + // 'name_arabic': nameArabic, + // 'name_english': nameEnglish, + // 'issue_date': issueDate, + // 'expiry_date': expiryDate, + // 'license_categories': licenseCategories, + // 'address': address, + // 'card_id': cardId, + // 'occupation': occupation, + // 'education': education, + // 'licenseIssueDate': licenseIssueDate, + // 'religion': religion, + // 'status': status, + // 'birthdate': birthdate, + // 'maritalStatus': maritalStatus, + // 'site': site, + // 'employmentType': employmentType, + // }; + // isLoading = true; + // update(); + // // Make POST request + // var res = await CRUD().post(link: AppLink.signUpCaptin, payload: payload); + // var status1 = jsonDecode(res); + // isLoading = false; + // update(); + // // Handle response + // + // if (status1['status'] == 'success') { + // isDriverSaved = true; + // Get.snackbar('Success', 'Driver data saved successfully', + // backgroundColor: AppColor.greenColor); + // } else { + // Get.snackbar('Error', 'Failed to save driver data', + // backgroundColor: Colors.red); + // } + // // } catch (e) { + // // Get.snackbar('Error', 'An error occurred while saving driver data', + // // backgroundColor: Colors.red); + // // } + // } Future addRegistrationCarEgypt() async { try { diff --git a/lib/controller/home/captin/order_request_controller.dart b/lib/controller/home/captin/order_request_controller.dart index 8957de6..20ca358 100644 --- a/lib/controller/home/captin/order_request_controller.dart +++ b/lib/controller/home/captin/order_request_controller.dart @@ -4,6 +4,7 @@ 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 'package:google_maps_flutter/google_maps_flutter.dart'; import '../../../constant/box_name.dart'; import '../../../constant/table_names.dart'; @@ -21,6 +22,8 @@ class OrderRequestController extends GetxController { String countRefuse = '0'; bool applied = false; final locationController = Get.put(LocationController()); + BitmapDescriptor startIcon = BitmapDescriptor.defaultMarker; + BitmapDescriptor endIcon = BitmapDescriptor.defaultMarker; @override void onInit() { @@ -30,6 +33,30 @@ class OrderRequestController extends GetxController { super.onInit(); } + 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(30, 30), devicePixelRatio: Get.pixelRatio); + BitmapDescriptor.fromAssetImage(config, 'assets/images/b.png', + mipmaps: false) + .then((value) { + endIcon = value; + update(); + }); + } + void changeApplied() { applied = true; update(); diff --git a/lib/controller/local/translations.dart b/lib/controller/local/translations.dart index 09db7fc..23d8d93 100644 --- a/lib/controller/local/translations.dart +++ b/lib/controller/local/translations.dart @@ -4,8 +4,21 @@ class MyTranslation extends Translations { @override Map> get keys => { "ar": { + "We use location to get accurate and nearest passengers for you": + "نستخدم الموقع للحصول على أقرب الركاب وأكثرهم دقة لك", + "This ride is already applied by another driver.": + "هذه الرحلة قام بقبولها سائق آخر بالفعل.", + "Please don't be late" + "My location is correct. You can search for me using the navigation app": + "موقعي صحيح. يمكنك البحث عني باستخدام تطبيق الملاحة", + "Hello, I'm at the agreed-upon location": + "مرحباً، أنا في المكان المتفق عليه", + "message From Driver": "رسالة من السائق", + "How much longer will you be?": "‏قدامك قد إيه", + 'Phone number is verified before': "تم التحقق من رقم الهاتف مسبقاً", + 'Change Ride': 'تغيير الرحلة', 'Cost Of Trip IS ': "تكلفة الرحلة هي", - 'message From passenger': "رسالة من الراكب", + "Where are you, sir?": "أنا وصلت حضرتك فين.", "I've been trying to reach you but your phone is off.": "بحاول أكلمك التلفون مغلق.", @@ -419,7 +432,7 @@ class MyTranslation extends Translations { "To change some Settings": "لتغيير بعض الإعدادات", "To change Language the App": "لتغيير لغة التطبيق", "Order Request Page": "صفحة طلب الطلبية", - "Rouats of Trip": "روات تريب", + "Routs of Trip": "طرق الرحلة", "Passenger Name is": "اسم المسافر", "Total From Passenger is": "إجمالي من الراكب هو", "Duration To Passenger is": "المدة إلى الراكب", @@ -718,7 +731,8 @@ class MyTranslation extends Translations { "لا توجد بطاقة SIM، لا توجد مشكلة! اتصل بالشريك السائق مباشرة من خلال تطبيقنا. نحن نستخدم التكنولوجيا المتقدمة لضمان خصوصيتك.", "This ride type allows changes, but the price may increase": "يسمح نوع الرحلة هذا بالتغييرات، لكن قد يرتفع السعر", - "message From passenger": "رسالة من الراكب", + 'message From Driver': '‏رسالة من السائق', + 'message From passenger': "رسالة من الراكب", "Select one message": "اختر رسالة واحدة", "My location is correct. You can search for me using the navigation app": "موقعي صحيح. يمكنك البحث عني باستخدام تطبيق الملاحة", diff --git a/lib/controller/rate/rate_conroller.dart b/lib/controller/rate/rate_conroller.dart index 1ff98ec..78d03d6 100644 --- a/lib/controller/rate/rate_conroller.dart +++ b/lib/controller/rate/rate_conroller.dart @@ -73,7 +73,7 @@ class RateController extends GetxController { } else { double pointsSubtraction = 0; pointsSubtraction = remainingFee * - (-1) * + (-1) / double.parse( Get.find().kazan); // for egypt /100 var paymentToken4 = await Get.find() @@ -88,7 +88,7 @@ class RateController extends GetxController { }); FirebaseMessagesController().sendNotificationToAnyWithoutData( 'Wallet Added'.tr, - 'Wallet Added${(pointsSubtraction).toStringAsFixed(0)}'.tr, + 'Wallet Added${(remainingFee).toStringAsFixed(0)}'.tr, Get.find().tokenPassenger, 'tone2.wav'); walletChecked = 'true'; diff --git a/lib/views/auth/captin/cards/egypt_card_a_i.dart b/lib/views/auth/captin/cards/egypt_card_a_i.dart index 5d2161d..c0a1ce3 100644 --- a/lib/views/auth/captin/cards/egypt_card_a_i.dart +++ b/lib/views/auth/captin/cards/egypt_card_a_i.dart @@ -80,7 +80,7 @@ class EgyptCardAI extends StatelessWidget { egyptCarLicenceBack(), egyptDriverIDFront(), egyptDriverIDBack(), - egyptCriminalRecord(), + // egyptCriminalRecord(), ], ), ), 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 index 468d748..a941572 100644 --- 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 @@ -10,6 +10,7 @@ import 'package:google_maps_flutter/google_maps_flutter.dart'; import '../../../../../constant/char_map.dart'; import '../../../../../constant/colors.dart'; import '../../../../../constant/credential.dart'; +import '../../../../../controller/functions/encrypt.dart'; import '../../../../../controller/functions/launch.dart'; import '../../../../Rate/ride_calculate_driver.dart'; import '../../../../../controller/functions/location_controller.dart'; @@ -30,19 +31,34 @@ GetBuilder leftMainMenuCaptainIcons() { // borderRadius: BorderRadius.circular(15)), // child: IconButton( // onPressed: () { - // AC credentials = AC(); - // String apiKey = '4601103'; - // String convertedStringN = credentials.c( - // credentials.c(credentials.c(apiKey, cs), cC), cn); - // print(convertedStringN); - // String retrievedStringS = credentials.r( - // credentials.r(credentials.r(convertedStringN, cn), cC), - // cs); - // print(retrievedStringS); - // // - // if (retrievedStringS == apiKey) { - // print('same'); - // } + // // AC credentials = AC(); + // String apiKey = 'mehmetDEV@2101'; + // // String convertedStringN = credentials.c( + // // credentials.c(credentials.c(apiKey, cs), cC), cn); + // // print(convertedStringN); + // // String retrievedStringS = credentials.r( + // // credentials.r(credentials.r(convertedStringN, cn), cC), + // // cs); + // // print(retrievedStringS); + // // // + // // if (retrievedStringS == apiKey) { + // // print('same'); + // // } + // + // // key.forEach((key, apiKey) { + // String encryptedApiKey = KeyEncryption.encryptKey(apiKey); + // print('Encrypted = $encryptedApiKey'); + // + // String decryptedApiKey = + // KeyEncryption.decryptKey(encryptedApiKey); + // print('Decrypted : $decryptedApiKey'); + // + // // if (decryptedApiKey == apiKey) { + // // print('Keys match for $decryptedApiKey'); + // // } else { + // // // print('Keys do not match for $key'); + // // } + // // }); // }, // icon: const Icon( // FontAwesome.map_signs, diff --git a/lib/views/home/Captin/mapDriverWidgets/passenger_info_window.dart b/lib/views/home/Captin/mapDriverWidgets/passenger_info_window.dart index 3056f82..b1037ef 100644 --- a/lib/views/home/Captin/mapDriverWidgets/passenger_info_window.dart +++ b/lib/views/home/Captin/mapDriverWidgets/passenger_info_window.dart @@ -92,6 +92,7 @@ class PassengerInfoWindow extends StatelessWidget { AppStyle.title, content: SizedBox( height: Get.height * .5, + width: Get.width * .6, child: ListView( // mainAxisAlignment: // MainAxisAlignment @@ -100,8 +101,7 @@ class PassengerInfoWindow extends StatelessWidget { InkWell( onTap: () { FirebaseMessagesController().sendNotificationToAnyWithoutData( - 'message From Driver' - .tr, + 'message From Driver', "Where are you, sir?" .tr, controller @@ -132,8 +132,7 @@ class PassengerInfoWindow extends StatelessWidget { InkWell( onTap: () { FirebaseMessagesController().sendNotificationToAnyWithoutData( - 'message From Driver' - .tr, + 'message From Driver', "I've been trying to reach you but your phone is off." .tr, controller @@ -164,8 +163,7 @@ class PassengerInfoWindow extends StatelessWidget { InkWell( onTap: () { FirebaseMessagesController().sendNotificationToAnyWithoutData( - 'message From Driver' - .tr, + 'message From Driver', "Please don't be late, I'm waiting for you at the specified location." .tr, controller @@ -196,8 +194,7 @@ class PassengerInfoWindow extends StatelessWidget { InkWell( onTap: () { FirebaseMessagesController().sendNotificationToAnyWithoutData( - 'message From Driver' - .tr, + 'message From Driver', "Please don't be late" .tr, controller @@ -226,7 +223,8 @@ class PassengerInfoWindow extends StatelessWidget { height: 5, ), SizedBox( - width: 335, + width: Get.width * + .5, child: Row( mainAxisAlignment: MainAxisAlignment @@ -237,8 +235,8 @@ class PassengerInfoWindow extends StatelessWidget { .formKey2, child: SizedBox( - width: - 300, + width: Get.width * + .4, child: MyTextForm( controller: controller.messageToPassenger, @@ -250,7 +248,7 @@ class PassengerInfoWindow extends StatelessWidget { onPressed: () { FirebaseMessagesController().sendNotificationToAnyWithoutData( - 'message From Driver'.tr, + 'message From Driver', controller.messageToPassenger.text, controller.tokenPassenger, 'ding.wav'); diff --git a/lib/views/home/Captin/orderCaptin/order_request_page.dart b/lib/views/home/Captin/orderCaptin/order_request_page.dart index c009730..cfe58cf 100644 --- a/lib/views/home/Captin/orderCaptin/order_request_page.dart +++ b/lib/views/home/Captin/orderCaptin/order_request_page.dart @@ -1,4 +1,5 @@ import 'package:SEFER/controller/home/captin/home_captain_controller.dart'; +import 'package:SEFER/views/widgets/mydialoug.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:SEFER/constant/box_name.dart'; @@ -33,8 +34,6 @@ class OrderRequestPage extends StatelessWidget { 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]); @@ -64,20 +63,6 @@ class OrderRequestPage extends StatelessWidget { // 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(); @@ -92,7 +77,7 @@ class OrderRequestPage extends StatelessWidget { // SizedBox(height: 200, child: Text(pointsList.toString())), // Text(message.notification!.body.toString()), SizedBox( - height: Get.height * .3, + height: Get.height * .33, child: GoogleMap( initialCameraPosition: CameraPosition( zoom: 12, @@ -109,13 +94,13 @@ class OrderRequestPage extends StatelessWidget { position: LatLng( latPassengerLocation, lngPassengerLocation), draggable: true, - icon: startIcon), + icon: orderRequestController.startIcon), Marker( markerId: MarkerId('Destination'.tr), position: LatLng( latPassengerDestination, lngPassengerDestination), draggable: true, - icon: endIcon), + icon: orderRequestController.endIcon), }, polylines: { Polyline( @@ -155,7 +140,7 @@ class OrderRequestPage extends StatelessWidget { 'Trip has Steps'.tr, style: AppStyle.title, ) - : Text('Rouats of Trip'.tr, + : Text('Routs of Trip'.tr, style: AppStyle.title)), Container( color: myList[13].toString() == 'true' @@ -209,12 +194,12 @@ class OrderRequestPage extends StatelessWidget { )), ), Container( - height: Get.height * .2, + height: Get.height * .15, width: Get.width * .9, decoration: AppStyle.boxDecoration1, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, + child: ListView( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // crossAxisAlignment: CrossAxisAlignment.start, children: [ Column( children: [ @@ -287,7 +272,7 @@ class OrderRequestPage extends StatelessWidget { Padding( padding: const EdgeInsets.all(4), child: Container( - color: AppColor.deepPurpleAccent, + color: AppColor.greenColor.withOpacity(.5), child: RichText( text: TextSpan( text: 'Cost Of Trip IS '.tr, @@ -321,68 +306,78 @@ class OrderRequestPage extends StatelessWidget { '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), - }); + var res = await CRUD().post( + link: AppLink.updateRideAndCheckIfApplied, + payload: { + 'id': myList[16], + 'rideTimeStart': DateTime.now().toString(), + 'status': 'Apply', + 'driver_id': box.read(BoxName.driverID), + }); + if (res == 'failure') { + MyDialog().getDialog( + "This ride is already applied by another driver." + .tr, + '', () { + Get.back(); + }); + } else { + List bodyToPassenger = [ + box.read(BoxName.driverID).toString(), + box.read(BoxName.nameDriver).toString(), + box.read(BoxName.tokenDriver).toString(), + ]; + FirebaseMessagesController() + .sendNotificationToPassengerToken( + 'Apply Ride', + 'your ride is applied'.tr, + // arguments['DriverList'][9].toString(), + arguments['DriverList'][9].toString(), + // box.read(BoxName.tokenDriver).toString(), + bodyToPassenger, + 'start.wav'); + Get.back(); + box.write(BoxName.rideArguments, { + '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(), + 'startNameLocation': myList[29].toString(), + 'endNameLocation': myList[30].toString(), + }); + 'passengerID =${box.read(BoxName.rideArguments)}'; + Get.to(() => PassengerLocationMapPage(), + arguments: box.read(BoxName.rideArguments)); + } // Get.back(); - List bodyToPassenger = [ - box.read(BoxName.driverID).toString(), - box.read(BoxName.nameDriver).toString(), - box.read(BoxName.tokenDriver).toString(), - ]; - FirebaseMessagesController() - .sendNotificationToPassengerToken( - 'Apply Ride', - 'your ride is applied'.tr, - // arguments['DriverList'][9].toString(), - arguments['DriverList'][9].toString(), - // box.read(BoxName.tokenDriver).toString(), - bodyToPassenger, - 'start.wav'); - Get.back(); - box.write(BoxName.rideArguments, { - '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(), - 'startNameLocation': myList[29].toString(), - 'endNameLocation': myList[30].toString(), - }); - 'passengerID =${box.read(BoxName.rideArguments)}'; - Get.to(() => PassengerLocationMapPage(), - arguments: box.read(BoxName.rideArguments)); }, ), GetBuilder( @@ -451,6 +446,6 @@ class OrderRequestPage extends StatelessWidget { ), ) ], - isleading: true); + isleading: false); } } diff --git a/lib/views/home/Captin/orderCaptin/order_speed_request.dart b/lib/views/home/Captin/orderCaptin/order_speed_request.dart index f96a3b1..ea9d976 100644 --- a/lib/views/home/Captin/orderCaptin/order_speed_request.dart +++ b/lib/views/home/Captin/orderCaptin/order_speed_request.dart @@ -37,8 +37,6 @@ class OrderSpeedRequest extends StatelessWidget { 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]); @@ -68,20 +66,6 @@ class OrderSpeedRequest extends StatelessWidget { // 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() { @@ -98,7 +82,7 @@ class OrderSpeedRequest extends StatelessWidget { // SizedBox(height: 200, child: Text(pointsList.toString())), // Text(message.notification!.body.toString()), SizedBox( - height: Get.height * .2, + height: Get.height * .33, child: GoogleMap( initialCameraPosition: CameraPosition( zoom: 12, @@ -115,13 +99,13 @@ class OrderSpeedRequest extends StatelessWidget { position: LatLng(latPassengerLocation, lngPassengerLocation), draggable: true, - icon: startIcon), + icon: orderRequestController.startIcon), Marker( markerId: MarkerId('Destination'.tr), position: LatLng( latPassengerDestination, lngPassengerDestination), draggable: true, - icon: endIcon), + icon: orderRequestController.endIcon), }, polylines: { Polyline( @@ -161,7 +145,7 @@ class OrderSpeedRequest extends StatelessWidget { 'Trip has Steps'.tr, style: AppStyle.title, ) - : Text('Rouats of Trip'.tr, + : Text('Routs of Trip'.tr, style: AppStyle.title)), Container( color: myList[13].toString() == 'true' @@ -191,6 +175,21 @@ class OrderSpeedRequest extends StatelessWidget { double.parse(myList[2]).toStringAsFixed(2), style: AppStyle.headTitle2, ), + AnimatedContainer( + duration: const Duration(seconds: 5), + curve: Curves.easeInOut, + child: AnimatedSize( + duration: const Duration(seconds: 5), + curve: Curves.easeInOut, + child: myList[31].toString() == 'Comfort' + ? const Icon( + Icons.ac_unit, + color: AppColor.blueColor, + size: 50, + ) + : const SizedBox(), + ), + ), Text( myList[31].toString(), style: AppStyle.title @@ -200,12 +199,12 @@ class OrderSpeedRequest extends StatelessWidget { )), ), Container( - height: Get.height * .2, + height: Get.height * .15, width: Get.width * .9, decoration: AppStyle.boxDecoration1, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, + child: ListView( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + // crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/pubspec.lock b/pubspec.lock index a0117a8..de705d5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -57,6 +57,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.4.2" + asn1lib: + dependency: transitive + description: + name: asn1lib + sha256: "58082b3f0dca697204dbab0ef9ff208bfaea7767ea771076af9a343488428dda" + url: "https://pub.dev" + source: hosted + version: "1.5.3" async: dependency: transitive description: @@ -361,6 +369,14 @@ packages: url: "https://pub.dev" source: hosted version: "5.4.3+1" + encrypt: + dependency: "direct main" + description: + name: encrypt + sha256: "62d9aa4670cc2a8798bab89b39fc71b6dfbacf615de6cf5001fb39f7e4a996a2" + url: "https://pub.dev" + source: hosted + version: "5.0.3" envied: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 8c25843..9ab40b4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -33,6 +33,7 @@ dependencies: flutter_paypal: ^0.2.0 flutter_launcher_icons: ^0.13.1 #to be remove # crypto: ^3.0.3 + encrypt: ^5.0.3 flutter_rating_bar: ^4.0.1 flutter_font_icons: ^2.2.5 # device_info_plus: ^9.1.0