diff --git a/android/app/build.gradle b/android/app/build.gradle index 39e9db8..f0a830b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -54,8 +54,8 @@ android { // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdk = 23 targetSdk = flutter.targetSdkVersion - versionCode = 109 - versionName = '1.5.09' + versionCode = 111 + versionName = '1.5.11' multiDexEnabled =true } diff --git a/assets/images/arrow.png b/assets/images/arrow.png new file mode 100644 index 0000000..3d3db75 Binary files /dev/null and b/assets/images/arrow.png differ diff --git a/assets/images/cardid.jpg b/assets/images/cardid.jpg deleted file mode 100644 index 608f2d1..0000000 Binary files a/assets/images/cardid.jpg and /dev/null differ diff --git a/assets/images/s.png b/assets/images/s.png new file mode 100644 index 0000000..a2dee59 Binary files /dev/null and b/assets/images/s.png differ diff --git a/assets/order1.wav b/assets/order1.wav new file mode 100644 index 0000000..919fdda Binary files /dev/null and b/assets/order1.wav differ diff --git a/bubble-master/lib/bubble.dart b/bubble-master/lib/bubble.dart index 03820a2..00fa44a 100755 --- a/bubble-master/lib/bubble.dart +++ b/bubble-master/lib/bubble.dart @@ -20,7 +20,9 @@ class Bubble { /// puts app in background and shows floaty-bubble head Future startBubbleHead({bool sendAppToBackground = true}) async { - ByteData bytes = await rootBundle.load('assets/images/logo1.png'); + ByteData bytes = await rootBundle.load( + 'assets/images/s.png', + ); var buffer = bytes.buffer; var encodedImage = base64.encode(Uint8List.view(buffer)); await _channel.invokeMethod('startBubbleHead', { diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index ea458d1..26de01b 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -2,8 +2,8 @@ - LSMinimumSystemVersion - 12.0 + LSMinimumSystemVersion + 12.0 UIBackgroundModes fetch @@ -35,7 +35,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 67 + 70 CFBundleSignature ???? CFBundleURLTypes @@ -50,7 +50,7 @@ CFBundleVersion - 4.0.67 + 4.0.70 FirebaseAppDelegateProxyEnabled NO GMSApiKey diff --git a/lib/constant/links.dart b/lib/constant/links.dart index 8cc7fb8..7cf7500 100644 --- a/lib/constant/links.dart +++ b/lib/constant/links.dart @@ -272,6 +272,8 @@ class AppLink { static String authCaptin = '$server/auth/captin'; static String loginCaptin = "$authCaptin/login.php"; static String loginFromGoogleCaptin = "$authCaptin/loginFromGoogle.php"; + static String loginUsingCredentialsWithoutGoogle = + "$authCaptin/loginUsingCredentialsWithoutGoogle.php"; static String packageInfo = "$server/auth/packageInfo.php"; static String signUpCaptin = "$authCaptin/register.php"; static String addCriminalDocuments = "$authCaptin/addCriminalDocuments.php"; diff --git a/lib/controller/auth/captin/login_captin_controller.dart b/lib/controller/auth/captin/login_captin_controller.dart index 468b323..7637d07 100644 --- a/lib/controller/auth/captin/login_captin_controller.dart +++ b/lib/controller/auth/captin/login_captin_controller.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:math'; import 'package:SEFER/constant/colors.dart'; import 'package:SEFER/controller/functions/location_background_controller.dart'; @@ -25,7 +26,10 @@ class LoginDriverController extends GetxController { TextEditingController emailController = TextEditingController(); TextEditingController phoneController = TextEditingController(); TextEditingController passwordController = TextEditingController(); + TextEditingController passwordController2 = TextEditingController(); bool isAgreeTerms = false; + bool isGoogleDashOpen = false; + bool isGoogleLogin = false; bool isloading = false; late int isTest = 1; final FlutterSecureStorage _storage = const FlutterSecureStorage(); @@ -35,6 +39,11 @@ class LoginDriverController extends GetxController { update(); } + void changeGoogleDashOpen() { + isGoogleDashOpen = !isGoogleDashOpen; + update(); + } + @override void onInit() async { box.read(BoxName.isTest) == null || @@ -80,6 +89,32 @@ class LoginDriverController extends GetxController { update(); } + String generateUniqueIdFromEmail(String email) { + // Step 1: Extract the local part of the email + String localPart = email.split('@')[0]; + + // Step 2: Replace invalid characters (if any) + String cleanLocalPart = localPart.replaceAll(RegExp(r'[^a-zA-Z0-9]'), ''); + + // Step 3: Ensure it does not exceed 24 characters + if (cleanLocalPart.length > 24) { + cleanLocalPart = cleanLocalPart.substring(0, 24); + } + + // Step 4: Generate a random suffix if needed + String suffix = generateRandomSuffix(24 - cleanLocalPart.length); + + return cleanLocalPart + suffix; + } + + String generateRandomSuffix(int length) { + const String chars = + 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; + Random random = Random(); + return List.generate(length, (index) => chars[random.nextInt(chars.length)]) + .join(''); + } + loginUsingCredentials(String driverID, email) async { isloading = true; update(); @@ -207,6 +242,135 @@ class LoginDriverController extends GetxController { } } + loginUsingCredentialsWithoutGoogle(String password, email) async { + isloading = true; + isGoogleLogin = true; + update(); + var res = await CRUD() + .get(link: AppLink.loginUsingCredentialsWithoutGoogle, payload: { + 'email': email, + 'password': password, + }); + box.write(BoxName.emailDriver, email.toString()); + print(res); + if (res == 'failure') { + //Failure + if (box.read(BoxName.phoneVerified).toString() == '1') { + Get.offAll(() => EgyptCardAI()); + } else { + Get.offAll(() => SmsSignupEgypt()); + } + + isloading = false; + update(); + // Get.snackbar('Failure', '', backgroundColor: Colors.red); + } else { + var jsonDecoeded = jsonDecode(res); + if (jsonDecoeded.isNotEmpty) { + if (jsonDecoeded['status'] == 'success' && + jsonDecoeded['data'][0]['is_verified'].toString() == '1') { + box.write(BoxName.emailDriver, jsonDecoeded['data'][0]['email']); + box.write(BoxName.driverID, jsonDecoeded['data'][0]['id']); + box.write(BoxName.isTest, '1'); + box.write(BoxName.gender, jsonDecoeded['data'][0]['gender']); + box.write(BoxName.phoneVerified, + jsonDecoeded['data'][0]['is_verified'].toString()); + box.write(BoxName.phoneDriver, jsonDecoeded['data'][0]['phone']); + box.write(BoxName.nameArabic, jsonDecoeded['data'][0]['name_arabic']); + box.write( + BoxName.bankCodeDriver, jsonDecoeded['data'][0]['bankCode']); + box.write(BoxName.accountBankNumberDriver, + jsonDecoeded['data'][0]['accountBank']); + box.write( + BoxName.nameDriver, + '${jsonDecoeded['data'][0]['first_name']}' + ' ${jsonDecoeded['data'][0]['last_name']}'); + if ((jsonDecoeded['data'][0]['model'].toString().contains('دراجه') || + jsonDecoeded['data'][0]['make'].toString().contains('دراجه '))) { + if (jsonDecoeded['data'][0]['gender'].toString() == 'Male') { + box.write(BoxName.carTypeOfDriver, 'Scooter'); + } else { + box.write(BoxName.carTypeOfDriver, 'Pink Bike'); + } + } else if (int.parse(jsonDecoeded['data'][0]['year'].toString()) > + 2017) { + if (jsonDecoeded['data'][0]['gender'].toString() != 'Male') { + box.write(BoxName.carTypeOfDriver, 'Lady'); + } else { + box.write(BoxName.carTypeOfDriver, 'Comfort'); + } + } else if (int.parse(jsonDecoeded['data'][0]['year'].toString()) > + 2002 && + int.parse(jsonDecoeded['data'][0]['year'].toString()) < 2017) { + box.write(BoxName.carTypeOfDriver, 'Speed'); + } else if (int.parse(jsonDecoeded['data'][0]['year'].toString()) < + 2002) { + box.write(BoxName.carTypeOfDriver, 'Awfar Car'); + } + updateAppTester(AppInformation.appName); + + var token = await CRUD().get( + link: AppLink.getDriverToken, + payload: {'captain_id': box.read(BoxName.driverID).toString()}); + + if (token != 'failure') { + if (jsonDecode(token)['data'][0]['token'] != + box.read(BoxName.tokenDriver)) { + Get.put(FirebaseMessagesController()) + .sendNotificationToAnyWithoutData( + 'token change'.tr, + 'change device'.tr, + jsonDecode(token)['data'][0]['token'].toString(), + 'promo.wav'); + Get.defaultDialog( + title: 'you will use this device?'.tr, + middleText: '', + confirm: MyElevatedButton( + title: 'Ok'.tr, + onPressed: () async { + await CRUD() + .post(link: AppLink.addTokensDriver, payload: { + 'token': box.read(BoxName.tokenDriver), + 'captain_id': box.read(BoxName.driverID).toString() + }); + CRUD().post( + link: + "${AppLink.seferAlexandriaServer}/ride/firebase/addDriver.php", + payload: { + 'token': box.read(BoxName.tokenDriver), + 'captain_id': + box.read(BoxName.driverID).toString() + }); + CRUD().post( + link: + "${AppLink.seferGizaServer}/ride/firebase/addDriver.php", + payload: { + 'token': box.read(BoxName.tokenDriver), + 'captain_id': + box.read(BoxName.driverID).toString() + }); + Get.back(); + })); + } + } + + Get.off(() => HomeCaptain()); + // Get.off(() => LoginCaptin()); + } else { + Get.offAll(() => SmsSignupEgypt()); + // Get.snackbar(jsonDecoeded['status'], jsonDecoeded['data'], + // backgroundColor: Colors.redAccent); + isloading = false; + update(); + } + } else { + Get.snackbar('failure'.tr, '', backgroundColor: AppColor.redColor); + isloading = false; + update(); + } + } + } + void loginByBoxData() async { Get.to(() => HomeCaptain()); await CRUD().post(link: AppLink.addTokensDriver, payload: { diff --git a/lib/controller/auth/captin/register_captin_controller.dart b/lib/controller/auth/captin/register_captin_controller.dart index 2fb27ec..5ab0ea6 100644 --- a/lib/controller/auth/captin/register_captin_controller.dart +++ b/lib/controller/auth/captin/register_captin_controller.dart @@ -296,10 +296,19 @@ class RegisterCaptainController extends GetxController { // link: AppLink.updateAccountBank, // payload: {'phone': '+2${phoneController.text}'}); // if (res1 != 'failure') { - await Get.put(LoginDriverController()).loginUsingCredentials( - box.read(BoxName.driverID).toString(), - box.read(BoxName.emailDriver).toString(), - ); + Get.find().isGoogleLogin == true + ? await Get.put(LoginDriverController()) + .loginUsingCredentialsWithoutGoogle( + Get.find() + .passwordController + .text + .toString(), + box.read(BoxName.emailDriver).toString(), + ) + : 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 cfe1e32..05015f8 100644 --- a/lib/controller/auth/google_sign.dart +++ b/lib/controller/auth/google_sign.dart @@ -11,6 +11,7 @@ import 'package:google_sign_in/google_sign_in.dart'; import '../../onbording_page.dart'; import '../../views/auth/captin/ai_page.dart'; +import '../functions/add_error.dart'; class GoogleSignInHelper { static final GoogleSignIn _googleSignIn = GoogleSignIn( @@ -81,7 +82,6 @@ class GoogleSignInHelper { // Get.snackbar('Google Sign-In error', '$error', // backgroundColor: AppColor.redColor); // // Log error details - // print('Google Sign-In error: $error'); // return null; // } // } @@ -97,9 +97,6 @@ class GoogleSignInHelper { final emailDriver = box.read(BoxName.emailDriver)?.toString() ?? 'Unknown Email'; - // print('Driver ID: $driverID'); - // print('Email Driver: $emailDriver'); - await Get.find() .loginUsingCredentials(driverID, emailDriver); } @@ -109,26 +106,10 @@ class GoogleSignInHelper { Get.snackbar('Google Sign-In error', '$error', backgroundColor: AppColor.redColor); addError(error.toString(), 'GoogleSignInAccount?> signInFromLogin()'); - print('Google Sign-In error: $error'); return null; } } - addError(String error, where) async { - CRUD().post(link: AppLink.addError, payload: { - 'error': error.toString(), // Example error description - 'userId': box.read(BoxName.driverID) ?? - box.read(BoxName.passengerID), // Example user ID - 'userType': box.read(BoxName.driverID) != null - ? 'Driver' - : 'passenger', // Example user type - 'phone': box.read(BoxName.phone) ?? - box.read(BoxName.phoneDriver), // Example phone number - - 'device': where - }); - } - // Method to handle Google Sign-Out static Future signOut() async { try { @@ -172,10 +153,7 @@ 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 5f8b809..26211c4 100644 --- a/lib/controller/firebase/firbase_messge.dart +++ b/lib/controller/firebase/firbase_messge.dart @@ -113,9 +113,13 @@ class FirebaseMessagesController extends GetxController { } Future fireBaseTitles(RemoteMessage message) async { - if (message.notification!.title! == 'Order'.tr) { + if (message.notification!.title! == 'OrderSpeed'.tr) { if (Platform.isAndroid) { - NotificationController().showNotification('Order'.tr, '', 'order', ''); + NotificationController().showNotification( + message.notification!.title.toString(), + message.notification!.body.toString(), + 'order', + ''); } // await FirebaseMessagesController().showOverlayNotification(message); var myListString = message.data['DriverList']; @@ -157,17 +161,34 @@ class FirebaseMessagesController extends GetxController { // Get.to(const VipOrderPage()); } else if (message.notification!.title! == 'message From passenger'.tr) { - passengerDialog(message.notification!.body!); + // passengerDialog(message.notification!.body!); if (Platform.isAndroid) { NotificationController() .showNotification('message From passenger'.tr, ''.tr, 'ding', ''); } + MyDialog().getDialog( + 'message From passenger'.tr, message.notification!.body!, () { + // FirebaseMessagesController().sendNotificationToPassengerToken( + // 'Hi ,I will go now'.tr, + // 'I will go now'.tr, + // Get.find().driverToken, []); + // Get.find() + // .startTimerDriverWaitPassenger5Minute(); + Get.back(); + }); } else if (message.notification!.title == 'Cancel') { - cancelTripDialog1(); if (Platform.isAndroid) { NotificationController() .showNotification('Cancel'.tr, ''.tr, 'cancel', ''); } + MyDialog().getDialog( + 'Passenger Cancel Trip'.tr, + 'Trip Cancelled. The cost of the trip will be added to your wallet.' + .tr, () { + box.write(BoxName.rideStatus, 'Cancel'); + Get.offAll(HomeCaptain()); + }); + // cancelTripDialog1(); } else if (message.notification!.title! == 'token change') { // NotificationController1() // .showNotification('token change'.tr, 'token change', 'cancel'); @@ -181,24 +202,16 @@ class FirebaseMessagesController extends GetxController { String result0 = await faceDetector(); // Handle the result here, e.g., show a dialog or update the UI var result = jsonDecode(result0); - Get.defaultDialog( - barrierDismissible: false, - title: 'Face Detection Result'.tr, - titleStyle: AppStyle.title, - content: Text( + MyDialogContent().getDialog( + 'Face Detection Result'.tr, + Text( result['similar'].toString() == 'true' ? 'similar'.tr : 'not similar'.tr, style: AppStyle.title, - ), - backgroundColor: result['similar'].toString() == 'true' - ? AppColor.greenColor - : AppColor.redColor, - confirm: MyElevatedButton( - title: 'OK'.tr, - onPressed: () { - Get.back(); - })); + ), () { + Get.back(); + }); update(); } else if (message.notification!.title! == 'Hi ,I will go now') { @@ -279,13 +292,21 @@ class FirebaseMessagesController extends GetxController { backgroundColor: AppColor.yellowColor, snackPosition: SnackPosition.BOTTOM, ); - } else if (message.notification!.title! == 'OrderSpeed') { + } else if (message.notification!.title! == 'Order') { + if (Platform.isAndroid) { + NotificationController().showNotification( + message.notification!.title.toString(), + message.notification!.body.toString(), + '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(); + Get.put(HomeCaptainController()).changeRideId(); update(); Get.to(() => OrderSpeedRequest(), arguments: { 'myListString': myListString, diff --git a/lib/controller/functions/add_error.dart b/lib/controller/functions/add_error.dart new file mode 100644 index 0000000..320a996 --- /dev/null +++ b/lib/controller/functions/add_error.dart @@ -0,0 +1,19 @@ +import '../../constant/box_name.dart'; +import '../../constant/links.dart'; +import '../../main.dart'; +import 'crud.dart'; + +addError(String error, where) async { + CRUD().post(link: AppLink.addError, payload: { + 'error': error.toString(), // Example error description + 'userId': box.read(BoxName.driverID) ?? + box.read(BoxName.passengerID), // Example user ID + 'userType': box.read(BoxName.driverID) != null + ? 'Driver' + : 'passenger', // Example user type + 'phone': box.read(BoxName.phone) ?? + box.read(BoxName.phoneDriver), // Example phone number + + 'device': where + }); +} diff --git a/lib/controller/functions/audio_controller.dart b/lib/controller/functions/audio_controller.dart new file mode 100644 index 0000000..5d5803a --- /dev/null +++ b/lib/controller/functions/audio_controller.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; +import 'package:just_audio/just_audio.dart'; +import 'package:get/get.dart'; + +class AudioController extends GetxController { + final AudioPlayer _audioPlayer = AudioPlayer(); + + Future playAudio() async { + // Check if the platform is Android + if (Theme.of(Get.context!).platform == TargetPlatform.android) { + try { + // Load the audio file from the raw resources + await _audioPlayer.setAsset( + 'assets/order1.wav'); // Adjust the path based on your project structure + _audioPlayer.play(); + } catch (e) { + // Handle errors, such as file not found + print('Error playing audio: $e'); + } + } + } + + @override + void onClose() { + // Release resources when done + _audioPlayer.dispose(); + super.onClose(); + } +} diff --git a/lib/controller/functions/gemeni.dart b/lib/controller/functions/gemeni.dart index 25d8966..8b6bf38 100644 --- a/lib/controller/functions/gemeni.dart +++ b/lib/controller/functions/gemeni.dart @@ -1,9 +1,11 @@ import 'dart:convert'; import 'dart:io'; +import 'dart:math'; import 'package:SEFER/constant/box_name.dart'; import 'package:SEFER/constant/info.dart'; import 'package:SEFER/constant/links.dart'; import 'package:SEFER/constant/style.dart'; +import 'package:SEFER/controller/auth/captin/login_captin_controller.dart'; import 'package:SEFER/controller/functions/crud.dart'; import 'package:SEFER/controller/functions/device_info.dart'; import 'package:SEFER/main.dart'; @@ -312,7 +314,13 @@ class AI extends GetxController { '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', + 'password': + Get.find().passwordController.text.isEmpty + ? box.read(BoxName.emailDriver).toString() + : Get.find() + .passwordController + .text + .toString(), 'gender': responseIdEgyptBack['gender']?.toString() ?? 'Not specified', 'license_type': responseIdEgyptDriverLicense['license_type']?.toString() ?? diff --git a/lib/controller/home/captin/map_driver_controller.dart b/lib/controller/home/captin/map_driver_controller.dart index 5847352..1655976 100644 --- a/lib/controller/home/captin/map_driver_controller.dart +++ b/lib/controller/home/captin/map_driver_controller.dart @@ -1,8 +1,10 @@ import 'dart:async'; import 'dart:convert'; +import 'dart:io'; import 'package:SEFER/controller/home/captin/home_captain_controller.dart'; import 'package:SEFER/controller/home/captin/order_request_controller.dart'; import 'package:SEFER/views/widgets/mydialoug.dart'; +import 'package:bubble_head/bubble.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; import 'package:get/get.dart'; @@ -303,9 +305,6 @@ class MapDriverController extends GetxController { box.read(BoxName.name).toString(), tokenPassenger, 'start.wav'); - if (box.read(BoxName.googlaMapApp) == true) { - await openGoogleMapFromDriverToPassenger(); - } } bool isSocialPressed = false; @@ -346,6 +345,7 @@ class MapDriverController extends GetxController { } void startRideFromStartApp() { + // if (box.read(BoxName.rideStatus) == 'Begin') { changeRideToBeginToPassenger(); isPassengerInfoWindow = false; isRideStarted = true; @@ -354,6 +354,8 @@ class MapDriverController extends GetxController { timeWaitingPassenger = 0; box.write(BoxName.statusDriverLocation, 'on'); update(); + // } + // rideIsBeginPassengerTimer(); } @@ -398,20 +400,15 @@ class MapDriverController extends GetxController { // var d = jsonDecode(res); update(); + Get.back(); // 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(); - }), - ); + Get.back(); + MyDialog().getDialog('Your are far from passenger location'.tr, + 'go to your passenger location before\nPassenger cancel trip'.tr, () { + Get.back(); + }); } } @@ -486,15 +483,10 @@ class MapDriverController extends GetxController { await calculateDistanceBetweenDriverAndPassengerLocation(); if (distance2 > 60) { - 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(); - })); + MyDialog().getDialog('Your are far from passenger location'.tr, + 'go to your passenger location before\nPassenger cancel trip'.tr, () { + Get.back(); + }); } else { double costOfWaiting5Minute = box.read(BoxName.countryCode) == 'Egypt' ? (distanceBetweenDriverAndPassengerWhenConfirm * .08) + (5 * 1) @@ -559,36 +551,22 @@ class MapDriverController extends GetxController { Get.find().myLocation.latitude, Get.find().myLocation.longitude, ); - Get.defaultDialog( - title: 'Are you sure to exit ride ?'.tr, - titleStyle: AppStyle.title, - middleText: '', - confirm: MyElevatedButton( - title: 'Ok'.tr, - kolor: AppColor.greenColor, - onPressed: () { - if (distanceToDestination > 900 || - (double.parse(distance) < 1000 && - distanceToDestination > 500)) { - Get.back(); - finishRideFromDriver1(); - } else { - Get.back(); - if (distanceToDestination < 150) { - // todo add scam from start point and dont move - // finishRideFromDriver1(); - } - MyDialog().getDialog('you are not moved yet !'.tr, '', () { - Get.back(); - }); - } - }), - cancel: MyElevatedButton( - title: 'Cancel'.tr, - kolor: Colors.red, - onPressed: () { - Get.back(); - })); + MyDialog().getDialog('Are you sure to exit ride ?'.tr, '', () { + if (distanceToDestination > 900 || + (double.parse(distance) < 1000 && distanceToDestination > 150)) { + Get.back(); + finishRideFromDriver1(); + } else { + Get.back(); + if (distanceToDestination <= 150) { + // todo add scam from start point and dont move + // finishRideFromDriver1(); + } + MyDialog().getDialog('you are not moved yet !'.tr, '', () { + Get.back(); + }); + } + }); } String paymentToken = ''; @@ -736,17 +714,12 @@ class MapDriverController extends GetxController { 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()); - }, - ), + MyDialog().getDialog( + 'Order Cancelled'.tr, + 'Order Cancelled by Passenger'.tr, + () { + Get.offAll(HomeCaptain()); + }, ); } } @@ -827,29 +800,25 @@ class MapDriverController extends GetxController { : (i ~/ 60) * (latePrice + .5) * 2 + (price); } price = carType == 'Comfort' // || carType == 'Free Ride' - ? (i ~/ 60) * (latePrice + .5) + - (price) - - int.parse(duration) * (latePrice + .5) + ? (latePrice + 0.5) * ((i ~/ 60) - int.parse(duration)) + price : carType == 'Lady' - ? (i ~/ 60) * (latePrice + .5) + - (price) - - int.parse(duration) * (latePrice + .5) + ? (latePrice + 0.5) * ((i ~/ 60) - int.parse(duration)) + + price : carType == 'RayehGaiComfort' - ? (i ~/ 60) * (latePrice + .5) + - (price) - - int.parse(duration) * (latePrice + .5) + ? (latePrice + 0.5) * ((i ~/ 60) - int.parse(duration)) + + price : price; } else if (currentTime.hour >= 14 && currentTime.hour <= 17) { price = carType == 'Comfort' // || carType == 'Free Ride' - ? (i ~/ 60) * (Get.find().heavyPrice) + - (price) - - int.parse(duration) * - (Get.find().heavyPrice + .5) + ? Get.find().heavyPrice * + ((i ~/ 60) - int.parse(duration)) + + price - + (0.5 * int.parse(duration)) : carType == 'Lady' - ? (i ~/ 60) * (Get.find().heavyPrice) + - (price) - - int.parse(duration) * - (Get.find().heavyPrice + .5) + ? Get.find().heavyPrice * + ((i ~/ 60) - int.parse(duration)) + + price - + (0.5 * int.parse(duration)) : carType == 'RayehGaiComfort' ? (i ~/ 60) * (Get.find().heavyPrice) + @@ -1191,11 +1160,21 @@ class MapDriverController extends GetxController { late String startNameLocation; late String endNameLocation; + Future runGoogleMapDirectly() async { + if (box.read(BoxName.googlaMapApp) == true) { + if (Platform.isAndroid) { + Bubble().startBubbleHead(sendAppToBackground: true); + } + await openGoogleMapFromDriverToPassenger(); + } + } + @override void onInit() async { mapAPIKEY = await storage.read(key: BoxName.mapAPIKEY); // Get the passenger location from the arguments. // await argumentLoading(); + runGoogleMapDirectly(); addCustomCarIcon(); addCustomPassengerIcon(); addCustomStartIcon(); diff --git a/lib/controller/home/captin/order_request_controller.dart b/lib/controller/home/captin/order_request_controller.dart index aebe104..9a1c1bd 100644 --- a/lib/controller/home/captin/order_request_controller.dart +++ b/lib/controller/home/captin/order_request_controller.dart @@ -3,13 +3,11 @@ import 'dart:convert'; 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 'package:google_maps_flutter/google_maps_flutter.dart'; import 'dart:math' as math; import '../../../constant/box_name.dart'; -import '../../../constant/table_names.dart'; +import '../../functions/audio_controller.dart'; import '../../functions/crud.dart'; import '../../functions/location_controller.dart'; import 'home_captain_controller.dart'; @@ -33,10 +31,14 @@ class OrderRequestController extends GetxController { @override void onInit() { + // AudioController audioController = Get.put(AudioController()); + + // audioController.playAudio(); // getRefusedOrderByCaptain(); initilizeOrderPage(); addCustomStartIcon(); addCustomEndIcon(); + // calculateConsumptionFuel(); update(); super.onInit(); diff --git a/lib/controller/local/translations.dart b/lib/controller/local/translations.dart index 745b844..196f0f8 100644 --- a/lib/controller/local/translations.dart +++ b/lib/controller/local/translations.dart @@ -63,6 +63,7 @@ class MyTranslation extends Translations { "Criminal Record": "السجل الجنائي", "ID Documents Back": "الوثيقه الشخصية - الخلفية", "Driver's License": "رخصة القيادة", + "No, still Waiting.": "لا، ما زلت في انتظار.", "you can show video how to setup": "يمكنك عرض فيديو حول كيفية الإعداد", "don't start trip if not": "لا تبدأ الرحلة إذا لم", @@ -544,6 +545,7 @@ Store your money with us and receive it in your bank as a monthly salary.''': "for your first registration!": "للتسجيل الأول!", "Get it Now!": "احصل عليه الآن!", "before": "قبل", + 'SEFER': 'سفر', "Code not approved": "الرمز غير موافق عليه", "3000 LE": "3000 جنيه مصري", "Do you have an invitation code from another driver?": @@ -1086,6 +1088,16 @@ Store your money with us and receive it in your bank as a monthly salary.''': "Warning: Speeding detected!": "تحذير: تم اكتشاف السرعة الزائدة!", "Please help! Contact me as soon as possible.": "من فضلك ساعدني! تواصل معي في أقرب وقت ممكن.", + "Email": "البريد الإلكتروني", + "Please enter your Email.": "يرجى إدخال بريدك الإلكتروني", + "Email must be correct.": "البريد الإلكتروني يجب أن يكون صحيحاً", + "Password": "كلمة المرور", + "Please enter your Password.": "يرجى إدخال كلمة المرور", + "Password must be at least 6 characters.": + "يجب أن تكون كلمة المرور مكونة من 6 أحرف على الأقل", + "Phone Number": "رقم الهاتف", + "Please enter your phone number.": "يرجى إدخال رقم هاتفك", + "Phone number must be valid.": "يجب أن يكون رقم الهاتف صحيحاً", "Share Trip Details": "شارك تفاصيل الرحلة", "Car Plate is": "لوحة السيارة", 'L.E': 'ج.م', diff --git a/lib/views/auth/captin/login_captin.dart b/lib/views/auth/captin/login_captin.dart index 17bb897..dfc6d60 100644 --- a/lib/views/auth/captin/login_captin.dart +++ b/lib/views/auth/captin/login_captin.dart @@ -2,6 +2,7 @@ import 'dart:io'; import 'package:SEFER/controller/auth/facebook_login.dart'; import 'package:SEFER/views/auth/captin/contact_us_page.dart'; +import 'package:SEFER/views/widgets/my_textField.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; @@ -20,6 +21,7 @@ import '../../../controller/auth/google_sign.dart'; import '../../../controller/functions/location_permission.dart'; import '../../../controller/functions/overlay_permisssion.dart'; import '../../../main.dart'; +import '../../../print.dart'; import '../../widgets/elevated_btn.dart'; import '../../widgets/my_scafold.dart'; import '../../widgets/mycircular.dart'; @@ -48,400 +50,332 @@ class LoginCaptin extends StatelessWidget { else SingleChildScrollView( child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, 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; - // }, - // ), - // controller.isloading - // ? const MyCircularProgressIndicator() - // : MyElevatedButton( - // onPressed: () { - // if (controller.formKey.currentState! - // .validate()) { - // controller.login(); - // } - // }, - // title: 'Submit'.tr, - // ), - // ], - // ), - // ), - // ), - // ), - // ) - - Center( + controller.isGoogleDashOpen + ? registerWitoutGoogle(controller) + : Padding( + padding: const EdgeInsets.all(25), + child: Center( child: Container( - decoration: AppStyle.boxDecoration1, - height: Get.height * .7, - width: Get.width * .9, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Image.asset( - 'assets/images/logo.gif', - height: Get.width * .3, - width: Get.width * .3, - fit: BoxFit.fill, - ), - Platform.isIOS && controller.isTest == 0 - ? Container( - decoration: AppStyle.boxDecoration, - child: Column( - children: [ - 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 + decoration: AppStyle.boxDecoration1, + height: Get.height * .7, + width: Get.width * .9, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Image.asset( + 'assets/images/logo.gif', + height: Get.width * .3, + width: Get.width * .3, + fit: BoxFit.fill, + ), + Platform.isIOS && controller.isTest == 0 + ? Container( + decoration: AppStyle.boxDecoration, + child: Column( + children: [ + 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: 15, - ), - TextFormField( - obscureText: true, - keyboardType: TextInputType - .emailAddress, - controller: controller - .passwordController, - decoration: InputDecoration( - focusedBorder: - OutlineInputBorder( - borderSide: - const BorderSide( - color: AppColor - .primaryColor, - width: 2.0, + labelText: 'Email'.tr, + hintText: + 'Enter your email address' + .tr, ), - borderRadius: - BorderRadius - .circular(10), + validator: (value) { + if (value!.isEmpty || + (!value.contains( + '@') || + !value.contains( + '.'))) { + return 'Please enter Your Email.' + .tr; + } + return null; + }, ), - fillColor: - AppColor.accentColor, - hoverColor: - AppColor.accentColor, - focusColor: - AppColor.accentColor, - border: const OutlineInputBorder( - borderRadius: - BorderRadius.all( - Radius + 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; - }, + 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< + LoginDriverController>( + builder: (controller) => + controller.isloading + ? const MyCircularProgressIndicator() + : MyElevatedButton( + onPressed: + () async { + if (controller + .formKey + .currentState! + .validate()) { + await Get.find() + .loginUsingCredentials( + controller + .passwordController + .text, + controller + .emailController + .text, + ); + } + }, + title: + 'Submit' + .tr, + ), + ) + ], ), - GetBuilder< - LoginDriverController>( - builder: (controller) => - controller.isloading - ? const MyCircularProgressIndicator() - : MyElevatedButton( - onPressed: - () async { - if (controller - .formKey - .currentState! - .validate()) { - await Get.find< - LoginDriverController>() - .loginUsingCredentials( - controller - .passwordController - .text, - controller - .emailController - .text, - ); - } - }, - title: - 'Submit'.tr, - ), - ) - ], + ), ), ), + const SizedBox( + height: 10, + ), + ], + ), + ) + : Container( + decoration: AppStyle.boxDecoration1, + height: Get.height * .3, + width: Get.width * .8, + child: Center( + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceAround, + children: [ + Text( + 'Sign in with Google for easier email and name entry' + .tr, + textAlign: TextAlign.center, + style: AppStyle.title, + ), + Text( + 'Or'.tr, + textAlign: TextAlign.center, + style: AppStyle.title, + ), + GestureDetector( + onTap: () async { + controller + .changeGoogleDashOpen(); + }, + child: Container( + padding: const EdgeInsets + .symmetric( + horizontal: 16, + vertical: 10), + decoration: BoxDecoration( + color: AppColor.blueColor, + borderRadius: + BorderRadius.circular( + 8), + ), + child: Row( + mainAxisSize: + MainAxisSize.min, + children: [ + const Icon( + Icons.email, + color: AppColor + .yellowColor, + ), + const SizedBox(width: 8), + Text( + 'Create new Account'.tr, + style: const TextStyle( + color: Colors.white, + fontSize: 16, + fontWeight: + FontWeight.w500, + ), + ), + ], + ), + ), + ), + ], ), ), - const SizedBox( - height: 10, + ), + GestureDetector( + onTap: () async { + await GoogleSignInHelper() + .signInFromLogin(); + }, + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 16, vertical: 10), + decoration: BoxDecoration( + color: AppColor.redColor, + borderRadius: BorderRadius.circular(8), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon( + FontAwesome.google, + color: AppColor.blueColor, + ), + const SizedBox(width: 8), + Text( + 'Sign In by Google'.tr, + style: const TextStyle( + color: Colors.white, + fontSize: 16, + fontWeight: FontWeight.w500, + ), ), ], ), - ) - : Container( - decoration: AppStyle.boxDecoration1, - height: Get.height * .3, - width: Get.width * .8, - child: Center( - child: Text( - 'Sign in with Google for easier email and name entry' - .tr, - textAlign: TextAlign.center, - style: AppStyle.title, - ), - ), ), - GestureDetector( - onTap: () async { - await GoogleSignInHelper().signInFromLogin(); - }, - child: Container( - padding: const EdgeInsets.symmetric( - horizontal: 16, vertical: 10), - decoration: BoxDecoration( - color: AppColor.redColor, - borderRadius: BorderRadius.circular(8), ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - const Icon( - FontAwesome.google, - color: AppColor.blueColor, - ), - const SizedBox(width: 8), - Text( - 'Sign In by Google'.tr, - style: const TextStyle( - color: Colors.white, - fontSize: 16, - fontWeight: FontWeight.w500, - ), - ), - ], - ), - ), + !Platform.isAndroid + ? GestureDetector( + onTap: () async { + User? user = await authController + .signInWithApple(); + if (user != null) { + box.write( + BoxName.driverID, user.uid); + box.write(BoxName.emailDriver, + user.email); + Get.find() + .loginUsingCredentials( + box + .read(BoxName.driverID) + .toString(), + box + .read(BoxName.emailDriver) + .toString(), + ); + // Navigate to another screen or perform other actions + } else {} + }, + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 16, vertical: 10), + decoration: BoxDecoration( + color: Colors.black, + borderRadius: + BorderRadius.circular(8), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon( + Icons.apple, + color: Colors.white, + size: 24, + ), + const SizedBox(width: 8), + Text( + 'Sign in with Apple'.tr, + style: const TextStyle( + color: Colors.white, + fontSize: 16, + fontWeight: FontWeight.w500, + ), + ), + ], + ), + ), + ) + : const SizedBox(), + ], ), - !Platform.isAndroid - ? GestureDetector( - onTap: () async { - User? user = await authController - .signInWithApple(); - if (user != null) { - box.write(BoxName.driverID, user.uid); - box.write( - BoxName.emailDriver, user.email); - Get.find() - .loginUsingCredentials( - box.read(BoxName.driverID).toString(), - box - .read(BoxName.emailDriver) - .toString(), - ); - // Navigate to another screen or perform other actions - } else {} - }, - child: Container( - padding: const EdgeInsets.symmetric( - horizontal: 16, vertical: 10), - decoration: BoxDecoration( - color: Colors.black, - borderRadius: BorderRadius.circular(8), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - const Icon( - Icons.apple, - color: Colors.white, - size: 24, - ), - const SizedBox(width: 8), - Text( - 'Sign in with Apple'.tr, - style: const TextStyle( - color: Colors.white, - fontSize: 16, - fontWeight: FontWeight.w500, - ), - ), - ], - ), - ), - ) - : const SizedBox(), - ], - ), - ))), + ))), GestureDetector( onTap: () => Get.to(() => ContactUsPage()), child: Text( @@ -458,6 +392,156 @@ class LoginCaptin extends StatelessWidget { ); } + Column registerWitoutGoogle(LoginDriverController controller) { + return Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Form( + key: controller.formKey, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: SingleChildScrollView( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(16.0), + child: TextFormField( + obscureText: false, // Email should not be obscured + 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, // English: Email / Arabic: البريد الإلكتروني + hintText: 'Please enter your Email.' + .tr, // English: Please enter your Email / Arabic: يرجى إدخال بريدك الإلكتروني + ), + validator: (value) { + if (value!.isEmpty) { + return 'Please enter your Email.' + .tr; // English: Please enter your Email / Arabic: يرجى إدخال بريدك الإلكتروني + } + if (!value.contains('@')) { + return 'Email must be correct.' + .tr; // English: Email must be correct / Arabic: البريد الإلكتروني يجب أن يكون صحيحاً + } + return null; + }, + ), + ), + Padding( + padding: const EdgeInsets.all(16.0), + child: TextFormField( + obscureText: true, // Password should be obscured + keyboardType: TextInputType.text, + 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, // English: Password / Arabic: كلمة المرور + hintText: 'Please enter your Password.' + .tr, // English: Please enter your Password / Arabic: يرجى إدخال كلمة المرور + ), + validator: (value) { + if (value!.isEmpty) { + return 'Please enter your Password.' + .tr; // English: Please enter your Password / Arabic: يرجى إدخال كلمة المرور + } + if (value.length < 6) { + return 'Password must be at least 6 characters.' + .tr; // English: Password must be at least 6 characters / Arabic: يجب أن تكون كلمة المرور مكونة من 6 أحرف على الأقل + } + return null; + }, + ), + ), + controller.isloading + ? const MyCircularProgressIndicator() + : MyElevatedButton( + onPressed: () { + if (controller.formKey.currentState!.validate()) { + String email = controller.emailController + .text; // Assume you have this controller + String uniqueId = + controller.generateUniqueIdFromEmail(email); + Log.print('Generated ID: $uniqueId'); + box.write(BoxName.driverID, uniqueId); + box.write(BoxName.emailDriver, + controller.emailController.text.toString()); + controller.loginUsingCredentialsWithoutGoogle( + controller.passwordController.text.toString(), + controller.emailController.text.toString(), + ); + } + }, + title: 'Next'.tr, + ), + ], + ), + ), + ), + ), + const SizedBox( + height: 200, + ), + GestureDetector( + onTap: () async { + await GoogleSignInHelper().signInFromLogin(); + }, + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), + decoration: BoxDecoration( + color: AppColor.redColor, + borderRadius: BorderRadius.circular(8), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon( + FontAwesome.google, + color: AppColor.blueColor, + ), + const SizedBox(width: 8), + Text( + 'Sign In by Google'.tr, + style: const TextStyle( + color: Colors.white, + fontSize: 16, + fontWeight: FontWeight.w500, + ), + ), + ], + ), + ), + ), + ], + ); + } + Padding agreedPage() { return Padding( padding: const EdgeInsets.all(16), diff --git a/lib/views/home/Captin/driver_map_page.dart b/lib/views/home/Captin/driver_map_page.dart index fff673e..ccf7d33 100644 --- a/lib/views/home/Captin/driver_map_page.dart +++ b/lib/views/home/Captin/driver_map_page.dart @@ -37,6 +37,7 @@ class PassengerLocationMapPage extends StatelessWidget { mapDriverController.startTimerToShowPassengerInfoWindowFromDriver(); return Scaffold( + // backgroundColor: AppColor.blueColor, // title: 'Map Passenger'.tr, body: SafeArea( child: Stack( diff --git a/lib/views/home/Captin/home_captain/home_captin.dart b/lib/views/home/Captin/home_captain/home_captin.dart index 3e42faa..693645c 100644 --- a/lib/views/home/Captin/home_captain/home_captin.dart +++ b/lib/views/home/Captin/home_captain/home_captin.dart @@ -5,7 +5,6 @@ import 'package:SEFER/controller/home/captin/map_driver_controller.dart'; import 'package:SEFER/views/notification/available_rides_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_overlay_window/flutter_overlay_window.dart'; import 'package:get/get.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:flutter_font_icons/flutter_font_icons.dart'; @@ -20,7 +19,6 @@ import '../../../../controller/functions/location_controller.dart'; import '../../../../controller/functions/overlay_permisssion.dart'; import '../../../../controller/functions/package_info.dart'; import '../../../../controller/home/captin/home_captain_controller.dart'; -import '../../../../controller/home/captin/order_request_controller.dart'; import '../../../widgets/circle_container.dart'; import '../driver_map_page.dart'; import 'widget/connect.dart'; @@ -37,8 +35,8 @@ class HomeCaptain extends StatelessWidget { @override Widget build(BuildContext context) { // Get.put(OrderRequestController()); - // Get.put(HomeCaptainController()); - Get.put(CaptainWalletController()); + Get.put(HomeCaptainController()); + // Get.put(CaptainWalletController()); WidgetsBinding.instance.addPostFrameCallback((_) async { closeOverlayIfFound(); checkForUpdate(context); @@ -51,25 +49,27 @@ class HomeCaptain extends StatelessWidget { appBar: AppBar( // backgroundColor: AppColor.accentColor, elevation: 1, - title: Text('Home'.tr), + title: Text( + 'SEFER'.tr, + style: AppStyle.title.copyWith(fontSize: 22), + ), actions: [ - GetBuilder( - builder: (orderRequestController) => MyCircleContainer( - child: Text( - orderRequestController.countRefuse.toString(), + MyCircleContainer( + child: Text( + homeCaptainController.countRefuse.toString(), style: AppStyle.title, - )), + ), ), ], ), drawer: CupertinoDrawerCaptain(), body: Stack( children: [ - GetBuilder( - builder: (controller) => controller.isLoading + GetBuilder(builder: (homeCaptainController) { + return homeCaptainController.isLoading ? const MyCircularProgressIndicator() : GoogleMap( - onMapCreated: controller.onMapCreated, + onMapCreated: homeCaptainController.onMapCreated, // cameraTargetBounds: CameraTargetBounds(controller.boundsdata), minMaxZoomPreference: const MinMaxZoomPreference(6, 18), @@ -82,24 +82,24 @@ class HomeCaptain extends StatelessWidget { markerId: MarkerId('MyLocation'.tr), position: locationController.myLocation, draggable: false, - icon: controller.carIcon, + icon: homeCaptainController.carIcon, rotation: locationController.heading) }, - mapType: controller.mapType + mapType: homeCaptainController.mapType ? MapType.satellite : MapType.terrain, myLocationButtonEnabled: true, // liteModeEnabled: true, tiltGesturesEnabled: false, // indoorViewEnabled: true, - trafficEnabled: controller.mapTrafficON, + trafficEnabled: homeCaptainController.mapTrafficON, buildingsEnabled: true, mapToolbarEnabled: true, myLocationEnabled: false, // liteModeEnabled: true, - ), - ), + ); + }), Positioned( bottom: 10, right: Get.width * .1, @@ -109,85 +109,83 @@ class HomeCaptain extends StatelessWidget { 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, + child: 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} ${homeCaptainController.totalMoneyInSEFER} ', + style: AppStyle.title, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text( + 'Total Budget 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, ), - 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} ${homeCaptainController.totalMoneyInSEFER} ', - style: AppStyle.title, - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Text( - 'Total Budget 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), - ), + 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, 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 c54f651..346f368 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 @@ -1,28 +1,21 @@ -import 'dart:io'; +import 'dart:convert'; import 'package:SEFER/constant/box_name.dart'; import 'package:SEFER/controller/firebase/local_notification.dart'; import 'package:SEFER/main.dart'; -import 'package:SEFER/views/auth/captin/cards/egypt_card_a_i.dart'; -import 'package:SEFER/views/auth/captin/cards/sms_signup.dart'; -import 'package:SEFER/views/auth/captin/login_captin.dart'; -import 'package:SEFER/views/home/Captin/driver_map_page.dart'; +import 'package:bubble_head/bubble.dart'; import 'package:flutter/material.dart'; import 'package:flutter_font_icons/flutter_font_icons.dart'; -import 'package:bubble_head/bubble.dart'; -import 'package:flutter_overlay_window/flutter_overlay_window.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 '../../../../../constant/links.dart'; -import '../../../../../controller/firebase/firbase_messge.dart'; -import '../../../../../controller/functions/location_permission.dart'; -import '../../../../../controller/functions/overlay_permisssion.dart'; -import '../../../../../print.dart'; +import '../../../../../controller/functions/audio_controller.dart'; import '../../../../Rate/ride_calculate_driver.dart'; import '../../../../../controller/functions/location_controller.dart'; +import '../../driver_map_page.dart'; +import '../../orderCaptin/order_speed_request.dart'; GetBuilder leftMainMenuCaptainIcons() { return GetBuilder( @@ -186,32 +179,7 @@ GetBuilder leftMainMenuCaptainIcons() { height: 5, ), // Platform.isAndroid - // ? AnimatedContainer( - // duration: const Duration(microseconds: 200), - // width: controller.widthMapTypeAndTraffic, - // decoration: BoxDecoration( - // color: AppColor.secondaryColor, - // border: Border.all(color: AppColor.blueColor), - // borderRadius: BorderRadius.circular(15)), - // child: Builder(builder: (context) { - // return IconButton( - // onPressed: () async { - // bool isOverlayActive = - // await FlutterOverlayWindow.isActive(); - // if (isOverlayActive) { - // await FlutterOverlayWindow.closeOverlay(); - // } - // // print(box.read(BoxName.tokenDriver)); - // }, - // icon: const Icon( - // FontAwesome5.window_close, - // size: 29, - // color: AppColor.blueColor, - // ), - // ); - // }), - // ) - // : const SizedBox(), + // ? // AnimatedContainer( // duration: const Duration(microseconds: 200), // width: controller.widthMapTypeAndTraffic, @@ -222,63 +190,109 @@ GetBuilder leftMainMenuCaptainIcons() { // child: Builder(builder: (context) { // return IconButton( // onPressed: () async { - // Get.to(() => LoginCaptin()); + // // NotificationController().showNotification( + // // ' message.notification!.title.toString()', + // // ' message.notification!.body.toString()', + // // 'order', + // // ''); + // }, + // icon: const Icon( + // FontAwesome5.window_close, + // size: 29, + // color: AppColor.blueColor, + // ), + // ); + // }), + // ), + // : const SizedBox(), + // AnimatedContainer( + // duration: const Duration(microseconds: 200), + // width: controller.widthMapTypeAndTraffic, + // decoration: BoxDecoration( + // color: AppColor.secondaryColor, + // border: Border.all(color: AppColor.blueColor), + // borderRadius: BorderRadius.circular(15)), + // child: Builder(builder: (context) { + // return IconButton( + // onPressed: () async { + // // Get.to(() => LoginCaptin()); // // print(box.read(BoxName.myList)); + // // Bubble().startBubbleHead(sendAppToBackground: true); + // List d = [ + // "30.003028,31.2419628", + // "30.0955661,31.2665336", + // "160.00", + // "25.92", + // "1488", + // "16.93", + // "114243034311436865474", + // "113172279072358305645", + // "hamza ayed", + // "rlMbi4Hc8L1STMPE99iPKqK4Gddwv8r9qZOCadsz9qTEJZ6KLEE9ruTJI6N8dKfK4CXez5pme5WIs14-1QGo29s07fQOniZgIlJV5XFL3yqzPRSUmn3", + // "+201023248456", + // "1 min", + // "1 m", + // "false", + // "QwUMoyUtZ0J3oR6yXKUavrB_gBl9npUZe-qZtax-Raq4QBbdKv0AmtLKm0BfBd6N_592HBv4CVa41ii4122W3hr-BCUKKzJhzZcK8m0YjbWbtpvgJRD8uD_nuMk9", + // "0", + // "238", + // "false", + // "114243034311436865474", + // "1488", + // "startEnd", + // "30.049307749732176,31.274291574954987", + // "", + // "", + // "", + // "", + // "17.73", + // "0", + // "hamzaayedflutter@gmail.com", + // "الفسطاط، حي مصر القديمة، مصر", + // " الزاوية الحمراء، محافظة القاهرة، مصر", + // "Speed", + // "8", + // "5.00" + // ]; - // // List d = [ - // // "30.003028,31.2419628", - // // "30.0955661,31.2665336", - // // "160.00", - // // "25.92", - // // "1488", - // // "16.93", - // // "114243034311436865474", - // // "113172279072358305645", - // // "hamza ayed", - // // "rlMbi4Hc8L1STMPE99iPKqK4Gddwv8r9qZOCadsz9qTEJZ6KLEE9ruTJI6N8dKfK4CXez5pme5WIs14-1QGo29s07fQOniZgIlJV5XFL3yqzPRSUmn3", - // // "+201023248456", - // // "1 min", - // // "1 m", - // // "false", - // // "QwUMoyUtZ0J3oR6yXKUavrB_gBl9npUZe-qZtax-Raq4QBbdKv0AmtLKm0BfBd6N_592HBv4CVa41ii4122W3hr-BCUKKzJhzZcK8m0YjbWbtpvgJRD8uD_nuMk9", - // // "0", - // // "238", - // // "false", - // // "114243034311436865474", - // // "1488", - // // "startEnd", - // // "30.049307749732176,31.274291574954987", - // // "", - // // "", - // // "", - // // "", - // // "17.73", - // // "0", - // // "hamzaayedflutter@gmail.com", - // // "الفسطاط، حي مصر القديمة، مصر", - // // " الزاوية الحمراء، محافظة القاهرة، مصر", - // // "Speed", - // // "8", - // // "5.00" - // // ]; - // // FirebaseMessagesController().sendNotificationToDriverMAP( - // // 'Order'.tr, - // // 'from: ', - // // // jsonDecode(value)['message'].toString(), - // // 'fKBBB4_1R0q18-byySHUeG:APA91bHk2RmjjMt6eKr7KQnqh4CK02yW3H5E8g_beVcQFgiCG50j9KCtSU1O8PtvS_gA5xuJLhaorDV9AeslcyLFJFf302tICKMiKgsDP5pWkF5WXNw0-4NsoD-BnJxf0-Do9Vs1Zbpq', - // // d, - // // 'order.wav'); - // // NotificationController() - // // .showNotification('VIP Order'.tr, '', 'order', ''); - // // try {} catch (e) { - // // print('Error showing overlay: $e'); - // // } - // // final Bubble _bubble = Bubble(showCloseButton: true); - // // try { - // // await _bubble.startBubbleHead(sendAppToBackground: false); - // // } on PlatformException { - // // print('Failed to call startBubbleHead'); - // // } + // box.write(BoxName.rideArguments, { + // 'passengerLocation': d[0].toString(), + // 'passengerDestination': d[1].toString(), + // 'Duration': d[4].toString(), + // 'totalCost': d[26].toString(), + // 'Distance': d[5].toString(), + // 'name': d[8].toString(), + // 'phone': d[10].toString(), + // 'email': d[28].toString(), + // 'WalletChecked': d[13].toString(), + // 'tokenPassenger': d[9].toString(), + // 'direction': + // 'https://www.google.com/maps/dir/${d[0]}/${d[1]}/', + // 'DurationToPassenger': d[15].toString(), + // 'rideId': d[16].toString(), + // 'passengerId': d[7].toString(), + // 'driverId': d[18].toString(), + // 'durationOfRideValue': d[19].toString(), + // 'paymentAmount': d[2].toString(), + // 'paymentMethod': + // d[13].toString() == 'true' ? 'visa' : 'cash', + // 'isHaveSteps': d[20].toString(), + // 'step0': d[21].toString(), + // 'step1': d[22].toString(), + // 'step2': d[23].toString(), + // 'step3': d[24].toString(), + // 'step4': d[25].toString(), + // 'passengerWalletBurc': d[26].toString(), + // 'timeOfOrder': DateTime.now().toString(), + // 'totalPassenger': d[2].toString(), + // 'carType': d[31].toString(), + // 'kazan': d[32].toString(), + // 'startNameLocation': d[29].toString(), + // 'endNameLocation': d[30].toString(), + // }); + // Get.to(() => PassengerLocationMapPage(), + // arguments: box.read(BoxName.rideArguments)); + // // Get.offAll(() => HomeCaptainController()); // }, // icon: const Icon( // FontAwesome5.grin_tears, @@ -288,6 +302,7 @@ GetBuilder leftMainMenuCaptainIcons() { // ); // }), // ), + // , const SizedBox( height: 5, ), diff --git a/lib/views/home/Captin/mapDriverWidgets/passenger_info_window.dart b/lib/views/home/Captin/mapDriverWidgets/passenger_info_window.dart index 54c6008..6a38d5b 100644 --- a/lib/views/home/Captin/mapDriverWidgets/passenger_info_window.dart +++ b/lib/views/home/Captin/mapDriverWidgets/passenger_info_window.dart @@ -1,4 +1,8 @@ +import 'dart:io'; + import 'package:SEFER/views/widgets/my_textField.dart'; +import 'package:SEFER/views/widgets/mydialoug.dart'; +import 'package:bubble_head/bubble.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_font_icons/flutter_font_icons.dart'; @@ -19,7 +23,7 @@ class PassengerInfoWindow extends StatelessWidget { @override Widget build(BuildContext context) { - Get.put(MapDriverController()); + // Get.put(MapDriverController()); return GetBuilder( builder: (controller) => controller.isPassengerInfoWindow == true ? Stack( @@ -275,6 +279,11 @@ class PassengerInfoWindow extends StatelessWidget { AppStyle.boxDecoration, child: IconButton( onPressed: () async { + if (Platform.isAndroid) { + Bubble().startBubbleHead( + sendAppToBackground: + true); + } await controller .openGoogleMapFromDriverToPassenger(); }, @@ -437,30 +446,15 @@ class PassengerInfoWindow extends StatelessWidget { 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(); // Close dialog after confirmation - }, - ), - cancel: MyElevatedButton( - title: 'No, still Waiting.'.tr, - kolor: AppColor.redColor, - onPressed: () { - Get.back(); // Close dialog without action - }, - ), + MyDialog().getDialog( + "Is the Passenger in your Car ?" + .tr, + "Don't start trip if not".tr, + () async { + await controller + .startRideFromDriver(); + // Close dialog after confirmation + }, ); }, ), @@ -489,21 +483,14 @@ class PassengerInfoWindow extends StatelessWidget { controller.isArrivedSend = false; } else { + MyDialog().getDialog( + 'You are not near the passenger location' + .tr, + 'Please go to the pickup location exactly' + .tr, () { + Get.back(); + }); // Show error dialog if the driver is far from passenger - Get.defaultDialog( - title: - 'You are not near the passenger location' - .tr, - middleText: - 'Please go to the pickup location exactly' - .tr, - confirm: MyElevatedButton( - title: 'Ok'.tr, - onPressed: () { - Get.back(); - }, - ), - ); } }, ) @@ -561,37 +548,24 @@ class PassengerInfoWindow extends StatelessWidget { 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 Cancelled Your Trip', - 'You will need to pay the cost to the driver, or it will be deducted from your next trip' - .tr, - controller.tokenPassenger, - [], - 'cancel.wav', - ); - await controller - .addWaitingTimeCostFromPassengerToDriverWallet(); - controller - .isdriverWaitTimeEnd = - false; - }, - ), - cancel: MyElevatedButton( - title: 'No'.tr, - onPressed: () { - Get.back(); - }, - ), - ); + MyDialog().getDialog( + 'Are you sure to cancel?'.tr, + '', () async { + FirebaseMessagesController() + .sendNotificationToPassengerToken( + 'Driver Cancelled Your Trip', + 'You will need to pay the cost to the driver, or it will be deducted from your next trip' + .tr, + controller.tokenPassenger, + [], + 'cancel.wav', + ); + await controller + .addWaitingTimeCostFromPassengerToDriverWallet(); + controller.isdriverWaitTimeEnd = + false; + Get.back(); + }); }, ) : const SizedBox(), @@ -604,48 +578,6 @@ class PassengerInfoWindow extends StatelessWidget { ), ], ) - // : 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/orderCaptin/order_speed_request.dart b/lib/views/home/Captin/orderCaptin/order_speed_request.dart index 8215cb2..8c1da67 100644 --- a/lib/views/home/Captin/orderCaptin/order_speed_request.dart +++ b/lib/views/home/Captin/orderCaptin/order_speed_request.dart @@ -327,57 +327,17 @@ class OrderSpeedRequest extends StatelessWidget { 'status': 'Apply', 'driver_id': box.read(BoxName.driverID), }); - CRUD().post( - link: - "${AppLink.seferAlexandriaServer}/rides/updateStausFromSpeed.php", - payload: { - 'id': orderRequestController.myList[16], - 'rideTimeStart': DateTime.now().toString(), - 'status': 'Apply', - 'driver_id': box.read(BoxName.driverID), - }); - CRUD().post( - link: - "${AppLink.seferGizaServer}/rides/updateStausFromSpeed.php", - payload: { - 'id': orderRequestController.myList[16], - 'rideTimeStart': DateTime.now().toString(), - 'status': 'Apply', - 'driver_id': box.read(BoxName.driverID), - }); - await CRUD().postFromDialogue( - link: AppLink.addDriverOrder, - payload: { - 'driver_id': - orderRequestController.myList[6].toString(), - // box.read(BoxName.driverID).toString(), - 'order_id': orderRequestController.myList[16] - .toString(), - 'status': 'Apply' - }); - CRUD().postFromDialogue( - link: - '${AppLink.seferAlexandriaServer}/driver_order/add.php', - payload: { - 'driver_id': - orderRequestController.myList[6].toString(), - // box.read(BoxName.driverID).toString(), - 'order_id': orderRequestController.myList[16] - .toString(), - 'status': 'Apply' - }); - - CRUD().postFromDialogue( - link: - '${AppLink.seferGizaServer}/driver_order/add.php', - payload: { - 'driver_id': - orderRequestController.myList[6].toString(), - // box.read(BoxName.driverID).toString(), - 'order_id': orderRequestController.myList[16] - .toString(), - 'status': 'Apply' - }); + if (AppLink.endPoint != AppLink.seferCairoServer) { + CRUD().post( + link: + "${AppLink.endPoint}/rides/updateStausFromSpeed.php", + payload: { + 'id': orderRequestController.myList[16], + 'rideTimeStart': DateTime.now().toString(), + 'status': 'Apply', + 'driver_id': box.read(BoxName.driverID), + }); + } // .then((value) { // var json = jsonDecode(res); @@ -414,28 +374,32 @@ class OrderSpeedRequest extends StatelessWidget { orderRequestController.body.toString(), 'status': 'Apply' }); - CRUD().postFromDialogue( - link: - '${AppLink.seferAlexandriaServer}/driver_order/add.php', + await CRUD().postFromDialogue( + link: AppLink.addDriverOrder, payload: { 'driver_id': orderRequestController.myList[6] .toString(), // box.read(BoxName.driverID).toString(), - 'order_id': - orderRequestController.body.toString(), - 'status': 'Apply' - }); - CRUD().postFromDialogue( - link: - '${AppLink.seferGizaServer}/driver_order/add.php', - payload: { - 'driver_id': orderRequestController.myList[6] + 'order_id': orderRequestController.myList[16] .toString(), - // box.read(BoxName.driverID).toString(), - 'order_id': - orderRequestController.body.toString(), 'status': 'Apply' }); + + if (AppLink.endPoint != AppLink.seferCairoServer) { + CRUD().post( + link: + "${AppLink.endPoint}/driver_order/add.php", + payload: { + 'driver_id': orderRequestController + .myList[6] + .toString(), + // box.read(BoxName.driverID).toString(), + 'order_id': orderRequestController + .myList[16] + .toString(), + 'status': 'Apply' + }); + } FirebaseMessagesController() .sendNotificationToPassengerToken( 'Apply Ride',