diff --git a/android/app/build.gradle b/android/app/build.gradle index 498582f..b810933 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 40 - versionName '1.5.40' + versionCode 42 + versionName '1.5.42' // manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml'] } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 87d5256..2da6c4a 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -11,6 +11,7 @@ + diff --git a/android/app/src/main/res/raw/ding.wav b/android/app/src/main/res/raw/ding.wav new file mode 100644 index 0000000..c53cd50 Binary files /dev/null and b/android/app/src/main/res/raw/ding.wav differ diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index df44879..187b651 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -37,11 +37,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 36 + 38 CFBundleSignature ???? CFBundleVersion - 4.3.6 + 4.3.8 FirebaseAppDelegateProxyEnabled NO GMSApiKey diff --git a/lib/constant/box_name.dart b/lib/constant/box_name.dart index be53a1d..bf87d51 100644 --- a/lib/constant/box_name.dart +++ b/lib/constant/box_name.dart @@ -5,6 +5,7 @@ class BoxName { static const String tokenParent = "tokenParent"; static const String lang = "lang"; + static const String gender = "gender"; static const String carType = "carType"; static const String carPlate = "carPlate"; static const String isVerified = '0'; diff --git a/lib/constant/links.dart b/lib/constant/links.dart index 53f0045..882f52d 100644 --- a/lib/constant/links.dart +++ b/lib/constant/links.dart @@ -163,6 +163,9 @@ class AppLink { //==================certifcate========== static String location = '$server/ride/location'; static String getCarsLocationByPassenger = "$location/get.php"; + static String getCarsLocationByPassengerSpeed = "$location/getSpeed.php"; + static String getCarsLocationByPassengerDelivery = + "$location/getDelivery.php"; static String getLocationParents = "$location/getLocationParents.php"; static String getFemalDriverLocationByPassenger = "$location/getFemalDriver.php"; diff --git a/lib/controller/auth/login_controller.dart b/lib/controller/auth/login_controller.dart index cfbfeea..a0f16a9 100644 --- a/lib/controller/auth/login_controller.dart +++ b/lib/controller/auth/login_controller.dart @@ -53,7 +53,7 @@ class LoginController extends GetxController { Get.offAll(SmsSignupEgypt()); isloading = false; update(); - Get.snackbar("User does not exist.".tr, '', backgroundColor: Colors.red); + // Get.snackbar("User does not exist.".tr, '', backgroundColor: Colors.red); } else { var jsonDecoeded = jsonDecode(res); if (jsonDecoeded.isNotEmpty) { @@ -75,6 +75,7 @@ class LoginController extends GetxController { 'token change'.tr, 'change device'.tr, jsonDecode(token)['data'][0]['token'].toString(), + 'cancel.wav', ); Future.delayed(const Duration(seconds: 1)); await CRUD().post(link: AppLink.addTokens, payload: { diff --git a/lib/controller/firebase/firbase_messge.dart b/lib/controller/firebase/firbase_messge.dart index ea36440..8bfa17f 100644 --- a/lib/controller/firebase/firbase_messge.dart +++ b/lib/controller/firebase/firbase_messge.dart @@ -159,6 +159,12 @@ class FirebaseMessagesController extends GetxController { .showNotification('message From passenger'.tr, ''.tr, 'tone2'); passengerDialog(message.notification!.body!); + update(); + } else if (message.notification!.title! == 'message From Driver'.tr) { + NotificationController() + .showNotification('message From passenger'.tr, ''.tr, 'tone2'); + passengerDialog(message.notification!.body!); + update(); } else if (message.notification!.title! == 'RideIsBegin') { Get.find().getBeginRideFromDriver(); @@ -332,7 +338,9 @@ class FirebaseMessagesController extends GetxController { FirebaseMessagesController().sendNotificationToPassengerToken( 'Hi ,I will go now'.tr, 'I will go now'.tr, - Get.find().driverToken, []); + Get.find().driverToken, + [], + 'ding.wav'); Get.find() .startTimerDriverWaitPassenger5Minute(); @@ -412,7 +420,7 @@ class FirebaseMessagesController extends GetxController { 'notification': { 'title': title, 'body': body, - 'sound': 'start.wav' + 'sound': 'ding.wav' }, 'priority': 'high', 'data': { @@ -455,7 +463,7 @@ class FirebaseMessagesController extends GetxController { // } void sendNotificationToPassengerToken( - String title, body, token, List map) async { + String title, body, token, List map, String tone) async { try { final response = await http.post( Uri.parse('https://fcm.googleapis.com/fcm/send'), @@ -467,7 +475,7 @@ class FirebaseMessagesController extends GetxController { 'notification': { 'title': title, 'body': body, - 'sound': 'tone2.wav' + 'sound': tone }, 'data': { 'passengerList': map, @@ -489,7 +497,7 @@ class FirebaseMessagesController extends GetxController { } void sendNotificationToAnyWithoutData( - String title, String body, String token) async { + String title, String body, String token, String tone) async { try { final response = await http.post( Uri.parse('https://fcm.googleapis.com/fcm/send'), @@ -501,7 +509,7 @@ class FirebaseMessagesController extends GetxController { 'notification': { 'title': title, 'body': body, - 'sound': 'promo.wav' + 'sound': tone }, 'data': { 'click_action': 'FLUTTER_NOTIFICATION_CLICK', @@ -524,8 +532,8 @@ class FirebaseMessagesController extends GetxController { } } - void sendNotificationToDriverMAP( - String title, String body, String token, List data) async { + void sendNotificationToDriverMAP(String title, String body, String token, + List data, String tone) async { try { final response = await http.post( Uri.parse('https://fcm.googleapis.com/fcm/send'), @@ -538,7 +546,7 @@ class FirebaseMessagesController extends GetxController { 'title': title, 'body': body, // 'sound': 'tone2.wav', - 'sound': 'order.wav' + 'sound': tone }, 'data': { 'DriverList': data, diff --git a/lib/controller/functions/call_controller.dart b/lib/controller/functions/call_controller.dart index 5e0a1d5..7c332a7 100644 --- a/lib/controller/functions/call_controller.dart +++ b/lib/controller/functions/call_controller.dart @@ -50,6 +50,7 @@ class CallController extends GetxController { uid.toString(), remoteUid.toString(), ], + 'iphone_ringtone.wav', ); join(); } diff --git a/lib/controller/functions/crud.dart b/lib/controller/functions/crud.dart index 88b8b7e..5006ebb 100644 --- a/lib/controller/functions/crud.dart +++ b/lib/controller/functions/crud.dart @@ -27,6 +27,7 @@ class CRUD { 'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}', }, ); + print(response.request); // if (response.statusCode == 200) { var jsonData = jsonDecode(response.body); if (jsonData['status'] == 'success') { diff --git a/lib/controller/functions/launch.dart b/lib/controller/functions/launch.dart index eaeecd2..f80ab1f 100644 --- a/lib/controller/functions/launch.dart +++ b/lib/controller/functions/launch.dart @@ -7,6 +7,14 @@ void showInBrowser(String url) async { } else {} } +Future makePhoneCall(String phoneNumber) async { + final Uri launchUri = Uri( + scheme: 'tel', + path: phoneNumber, + ); + await launchUrl(launchUri); +} + void launchCommunication( String method, String contactInfo, String message) async { String url; @@ -35,6 +43,7 @@ void launchCommunication( case 'phone': url = 'tel:$contactInfo'; break; + case 'sms': url = 'sms:$contactInfo?body=${Uri.encodeComponent(message)}'; break; diff --git a/lib/controller/home/map_passenger_controller.dart b/lib/controller/home/map_passenger_controller.dart index 26ebec3..be86bf3 100644 --- a/lib/controller/home/map_passenger_controller.dart +++ b/lib/controller/home/map_passenger_controller.dart @@ -44,6 +44,7 @@ class MapPassengerController extends GetxController { TextEditingController wayPoint3Controller = TextEditingController(); TextEditingController wayPoint4Controller = TextEditingController(); TextEditingController sosPhonePassengerProfile = TextEditingController(); + TextEditingController whatsAppLocationText = TextEditingController(); final sosFormKey = GlobalKey(); final increaseFeeFormKey = GlobalKey(); List data = []; @@ -111,6 +112,7 @@ class MapPassengerController extends GetxController { bool isDriverArrivePassenger = false; bool startLocationFromMap = false; bool isAnotherOreder = false; + bool isWhatsAppOrder = false; bool passengerStartLocationFromMap = false; bool workLocationFromMap = false; bool homeLocationFromMap = false; @@ -472,6 +474,11 @@ class MapPassengerController extends GetxController { update(); } + void changeIsWhatsAppOrder(bool val) { + isWhatsAppOrder = val; + update(); + } + void sendSMS(String to) async { // Get the driver's phone number. String driverPhone = @@ -682,10 +689,11 @@ class MapPassengerController extends GetxController { box.write(BoxName.passengerWalletTotal, '0'); if (box.read(BoxName.parentTripSelected) == true) { FirebaseMessagesController().sendNotificationToPassengerToken( - "Finish Monitor", + "Finish Monitor".tr, "Finish Monitor".tr, box.read(BoxName.tokenParent), [], + 'order1.wav', ); box.write(BoxName.parentTripSelected, false); box.remove(BoxName.tokenParent); @@ -878,6 +886,72 @@ class MapPassengerController extends GetxController { })); } + Map? extractCoordinatesFromWhatsAppLink(String link) { + try { + Uri uri = Uri.parse(link); + + if (uri.host == 'maps.google.com') { + String? query = uri.queryParameters['q']; + + if (query != null) { + List coordinates = query.split(','); + + if (coordinates.length == 2) { + double latitude = double.parse(coordinates[0]); + double longitude = double.parse(coordinates[1]); + + return { + 'latitude': latitude, + 'longitude': longitude, + }; + } + } + } + } catch (e) { + print('Error parsing WhatsApp location link: $e'); + } + + return null; + } + + double latitudeWhatsApp = 0; + double longitudeWhatsApp = 0; + void handleWhatsAppLink(String link) { + Map? coordinates = extractCoordinatesFromWhatsAppLink(link); + + if (coordinates != null) { + latitudeWhatsApp = coordinates['latitude']!; + longitudeWhatsApp = coordinates['longitude']!; + + print( + 'Extracted coordinates: Lat: $latitudeWhatsApp, Long: $longitudeWhatsApp'); + // Use these coordinates in your app as needed + } else { + print('Failed to extract coordinates from the link'); + } + } + +// Example usage + void someFunction() { + String whatsAppLink = 'https://maps.google.com/maps?q=37.4220,-122.0841'; + handleWhatsAppLink(whatsAppLink); + } + + void goToWhatappLocation() async { + if (sosFormKey.currentState!.validate()) { + changeIsWhatsAppOrder(true); + Get.back(); + handleWhatsAppLink(whatsAppLocationText.text); + myDestination = LatLng(latitudeWhatsApp, longitudeWhatsApp); + await mapController?.animateCamera(CameraUpdate.newLatLng( + LatLng(passengerLocation.latitude, passengerLocation.longitude))); + changeMainBottomMenuMap(); + passengerStartLocationFromMap = true; + isPickerShown = true; + update(); + } + } + int currentTimeSearchingCaptainWindow = 0; late String driverPhone = ''; late String driverRate = ''; @@ -939,7 +1013,8 @@ class MapPassengerController extends GetxController { 'carType': box.read(BoxName.carType), "price_for_driver": totalPassenger.toString(), "price_for_passenger": totalME.toString(), - "distance": distance.toString() + "distance": distance.toString(), + "paymentMethod": paymentController.isWalletChecked.toString(), }).then((value) { // List body = [ rideId = jsonDecode(value)['message']; @@ -987,12 +1062,15 @@ class MapPassengerController extends GetxController { passengerRate.toStringAsFixed(2), ]; // FirebaseMessagesController().sendNotificationToDriverMAP( - 'Order', - jsonDecode(value)['message'].toString(), - dataCarsLocationByPassenger['message'][carsOrder]['token'].toString(), - body, - // polylineCoordinates.toString() - ); + 'Order'.tr, + jsonDecode(value)['message'].toString(), + dataCarsLocationByPassenger['message'][carsOrder]['token'] + .toString(), + body, + 'order.wav' + + // polylineCoordinates.toString() + ); }); delayAndFetchRideStatus(rideId); if (shouldFetch == false) { @@ -1188,9 +1266,11 @@ class MapPassengerController extends GetxController { driversToken.remove(driverToken); for (var i = 1; i < driversToken.length; i++) { FirebaseMessagesController().sendNotificationToAnyWithoutData( - 'Order Applied', - '$driverName Apply order\nTake attention in other order'.tr, - driversToken[i]); + 'Order Applied', + '$driverName Apply order\nTake attention in other order'.tr, + driversToken[i], + 'start.wav', + ); } // } } @@ -1212,6 +1292,26 @@ class MapPassengerController extends GetxController { 'northeastLat': bounds.northeast.latitude.toString(), 'northeastLon': bounds.northeast.longitude.toString(), }); + } else if (box.read(BoxName.carType) == 'Speed') { + res = await CRUD().get( + link: AppLink.getCarsLocationByPassengerSpeed, + payload: { + 'southwestLat': bounds.southwest.latitude.toString(), + 'southwestLon': bounds.southwest.longitude.toString(), + 'northeastLat': bounds.northeast.latitude.toString(), + 'northeastLon': bounds.northeast.longitude.toString(), + }, + ); + } else if (box.read(BoxName.carType) == 'Delivery') { + res = await CRUD().get( + link: AppLink.getCarsLocationByPassengerDelivery, + payload: { + 'southwestLat': bounds.southwest.latitude.toString(), + 'southwestLon': bounds.southwest.longitude.toString(), + 'northeastLat': bounds.northeast.latitude.toString(), + 'northeastLon': bounds.northeast.longitude.toString(), + }, + ); } else { res = await CRUD() .get(link: AppLink.getCarsLocationByPassenger, payload: { @@ -1373,10 +1473,12 @@ class MapPassengerController extends GetxController { } else if (res1['status'] == 'success') { var tokenParent = res1['data'][0]['token']; FirebaseMessagesController().sendNotificationToPassengerToken( - "Trip Monitoring", - "Trip Monitoring".tr, - tokenParent, - [rideId, driverId]); + "Trip Monitoring".tr, + "Trip Monitoring".tr, + tokenParent, + [rideId, driverId], + 'order1.wav', + ); box.write(BoxName.parentTripSelected, true); box.write(BoxName.tokenParent, tokenParent); } @@ -1519,7 +1621,12 @@ class MapPassengerController extends GetxController { "status": 'Cancel' }); FirebaseMessagesController().sendNotificationToDriverMAP( - 'Cancel Trip', 'Trip Cancelled'.tr, driverToken, []); + 'Cancel Trip'.tr, + 'Trip Cancelled'.tr, + driverToken, + [], + 'cancel.wav', + ); } // rideConfirm = false; // shouldFetch = false; @@ -2152,8 +2259,10 @@ class MapPassengerController extends GetxController { data = response['routes'][0]['legs']; box.remove(BoxName.tripData); box.write(BoxName.tripData, response); - startNameAddress = data[0]['start_address']; - endNameAddress = data[0]['end_address']; + + startNameAddress = shortenAddress(data[0]['start_address']); + print('data[0][start_address]: ${data[0]['start_address']}'); + endNameAddress = shortenAddress(data[0]['end_address']); isLoading = false; newStartPointLocation = LatLng( data[0]["start_location"]['lat'], data[0]["start_location"]['lng']); @@ -2220,6 +2329,43 @@ class MapPassengerController extends GetxController { } } + String shortenAddress(String fullAddress) { + // Split the address into parts + List parts = fullAddress.split('،'); + + // Remove any leading or trailing whitespace from each part + parts = parts.map((part) => part.trim()).toList(); + + // Remove any empty parts + parts = parts.where((part) => part.isNotEmpty).toList(); + + // Initialize the short address + String shortAddress = ''; + + // Add the first part (usually the most specific location) + if (parts.isNotEmpty) { + shortAddress += parts[0]; + } + + // Add the district or area name (usually the third part in this format) + if (parts.length > 2) { + shortAddress += '، ${parts[2]}'; + } + + // Add the country (usually the last part) + if (parts.length > 1) { + shortAddress += '، ${parts.last}'; + } + + // Remove any part that's just numbers (like postal codes) + shortAddress = shortAddress + .split('،') + .where((part) => !RegExp(r'^[0-9 ]+$').hasMatch(part.trim())) + .join('،'); + + return shortAddress; + } + double distanceOfDestination = 0; bool haveSteps = false; late LatLng latestPosition; diff --git a/lib/controller/local/translations.dart b/lib/controller/local/translations.dart index 534f27c..6c1833e 100644 --- a/lib/controller/local/translations.dart +++ b/lib/controller/local/translations.dart @@ -4,6 +4,15 @@ class MyTranslation extends Translations { @override Map> get keys => { "ar": { + 'Change Ride': 'تغيير الرحلة', + 'You can change the destination by long-pressing any point on the map': + 'يمكنك تغيير الوجهة بالضغط مطولاً على أي نقطة على الخريطة', + + "WhatsApp Location Extractor": "مستخرج موقع واتساب", + "Location Link": "رابط الموقع", + "Paste location link here": "الصق رابط الموقع هنا", + "Go to this location": "انتقل إلى هذا الموقع", + "Paste WhatsApp location link here": "الصق رابط موقع واتساب هنا", "Pick from map destination": "حدد وجهتك على الخريطة", "Pick or Tap to confirm": "حدد أو انقر للتأكيد", "Select Order Type": "حدد نوع الطلب", @@ -765,6 +774,14 @@ iOS [https://getapp.cc/app/6458734951] "Duration is": "المدة هي", "Leave": "مغادرة", "Join": "الانضمام", + "Heading your way now. Please be ready.": + "في طريقي إليك الآن. يرجى الاستعداد.", + "Approaching your area. Should be there in 3 minutes.": + "اقترب من منطقتك. يجب أن أكون هناك خلال 3 دقائق.", + "There's heavy traffic here. Can you suggest an alternate pickup point?": + "هناك حركة مرور كثيفة هنا. هل يمكنك اقتراح نقطة استلام بديلة؟", + "This ride is already taken by another driver.": + "تم حجز هذه الرحلة من قبل سائق آخر.", "You Should be select reason.": "يجب أن تختار السبب.", " \$": " دينار ", "Waiting for Driver ...": "في انتظار السائق...", diff --git a/lib/controller/notification/passenger_notification_controller.dart b/lib/controller/notification/passenger_notification_controller.dart index 1ed0009..39a725b 100644 --- a/lib/controller/notification/passenger_notification_controller.dart +++ b/lib/controller/notification/passenger_notification_controller.dart @@ -53,8 +53,13 @@ class PassengerNotificationController extends GetxController { 'title': title, 'body': body, }); - FirebaseMessagesController() - .sendNotificationToPassengerToken(title, body, 'token', []); + FirebaseMessagesController().sendNotificationToPassengerToken( + title, + body, + 'token', + [], + 'iphone_ringtone.wav', + ); } @override diff --git a/lib/controller/profile/profile_controller.dart b/lib/controller/profile/profile_controller.dart index 73e92e3..5763af5 100644 --- a/lib/controller/profile/profile_controller.dart +++ b/lib/controller/profile/profile_controller.dart @@ -14,7 +14,7 @@ class ProfileController extends GetxController { bool isloading = false; Map prfoileData = {}; TextEditingController txtController = TextEditingController(); - List genders = ['Male', 'Female', 'Non-binary']; + List genders = ['Male', 'Female', 'Other']; String gender = 'Male'; @@ -99,6 +99,10 @@ class ProfileController extends GetxController { } else { var jsonDecoded = jsonDecode(res); prfoileData = jsonDecoded['data']; + box.write(BoxName.sosPhonePassenger, prfoileData['sosPhone'].toString()); + box.write(BoxName.gender, prfoileData['gender'].toString()); + box.write(BoxName.name, + '${prfoileData['first_name']} ${prfoileData['last_name']}'); isloading = false; update(); } diff --git a/lib/controller/rate/rate_conroller.dart b/lib/controller/rate/rate_conroller.dart index 6297617..aa130b0 100644 --- a/lib/controller/rate/rate_conroller.dart +++ b/lib/controller/rate/rate_conroller.dart @@ -71,9 +71,10 @@ class RateController extends GetxController { }); if (res != 'failure') { FirebaseMessagesController().sendNotificationToAnyWithoutData( - 'You Have Tips', + 'You Have Tips'.tr, '${'${tip.toString()}\$${' tips\nTotal is'.tr}'} ${tip + (Get.find().totalPassenger)}', Get.find().driverToken.toString(), + 'ding.wav', ); } } diff --git a/lib/views/auth/login_page.dart b/lib/views/auth/login_page.dart index 61cf9f7..015d36d 100644 --- a/lib/views/auth/login_page.dart +++ b/lib/views/auth/login_page.dart @@ -1,7 +1,5 @@ import 'dart:io'; -import 'package:SEFER/controller/home/map_passenger_controller.dart'; -import 'package:SEFER/views/widgets/my_dialog.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; @@ -88,15 +86,17 @@ class LoginPage extends StatelessWidget { if (user != null) { box.write(BoxName.passengerID, user.uid); box.write(BoxName.email, user.email); - await Get.put(LoginController()) - .loginUsingCredentials( + await controller.loginUsingCredentials( box .read(BoxName.passengerID) .toString(), box.read(BoxName.email).toString(), ); // Navigate to another screen or perform other actions - } else {} + } else { + Get.snackbar('user not found'.tr, '', + backgroundColor: AppColor.redColor); + } }, child: Container( padding: const EdgeInsets.symmetric( diff --git a/lib/views/auth/sms_verfy_page.dart b/lib/views/auth/sms_verfy_page.dart index 015108e..f2428b5 100644 --- a/lib/views/auth/sms_verfy_page.dart +++ b/lib/views/auth/sms_verfy_page.dart @@ -74,51 +74,18 @@ class SmsSignupEgypt extends StatelessWidget { height: 10, ), if (registerController.isSent) - Obx(() => Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: registerController.remainingTime > 0 - ? Column( - children: [ - Text( - '${(registerController.remainingTime / 60).floor()}:${(registerController.remainingTime % 60).toString().padLeft(2, '0')} remaining', - style: AppStyle.subtitle, - textAlign: TextAlign.center, - ), - const SizedBox(height: 8), - LinearProgressIndicator( - value: registerController.remainingTime / - 300, // Assuming 300 seconds (5 minutes) total - backgroundColor: Colors.grey[300], - valueColor: AlwaysStoppedAnimation( - Theme.of(context).primaryColor), - ), - ], - ) - : TextButton( - onPressed: () => - registerController.sendOtpMessage(), - child: Text('Resend code'.tr), - ), - ), - const SizedBox( - height: - 16), // Add some space after the timer or button - ], - )), - Padding( - padding: const EdgeInsets.all(16.0), - child: registerController.isSent - ? Form( - key: registerController.formKey3, - child: MyTextForm( - controller: registerController.verifyCode, - label: '5 digit'.tr, - hint: '5 digit'.tr, - type: TextInputType.number), - ) - : const SizedBox()), + Padding( + padding: const EdgeInsets.all(16.0), + child: registerController.isSent + ? Form( + key: registerController.formKey3, + child: MyTextForm( + controller: registerController.verifyCode, + label: '5 digit'.tr, + hint: '5 digit'.tr, + type: TextInputType.number), + ) + : const SizedBox()), // Submit button MyElevatedButton( onPressed: () async { @@ -132,7 +99,7 @@ class SmsSignupEgypt extends StatelessWidget { ); }), ], - isleading: true, + isleading: false, ); } } diff --git a/lib/views/home/map_widget.dart/apply_order_widget.dart b/lib/views/home/map_widget.dart/apply_order_widget.dart index b398f96..22bea19 100644 --- a/lib/views/home/map_widget.dart/apply_order_widget.dart +++ b/lib/views/home/map_widget.dart/apply_order_widget.dart @@ -9,6 +9,7 @@ import 'package:flutter/services.dart'; import 'package:get/get.dart'; import '../../../constant/box_name.dart'; +import '../../../controller/functions/launch.dart'; class ApplyOrderWidget extends StatelessWidget { const ApplyOrderWidget({super.key}); @@ -108,7 +109,23 @@ class ApplyOrderWidget extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Image.asset( - 'assets/images/blob.png', + box.read(BoxName.carType) == 'Comfort' + ? 'assets/images/blob.png' + : box.read(BoxName.carType) == 'Lady' + ? 'assets/images/lady.png' // Assuming there's an image for Lady + : box.read(BoxName.carType) == 'Speed' + ? 'assets/images/carspeed.png' + : box.read(BoxName.carType) == + 'Delivery' + ? 'assets/images/moto.png' + : box.read(BoxName.carType) == + 'Mashwari' + ? 'assets/images/freeRide.png' + : box.read(BoxName + .carType) == + 'Rayeh Gai' + ? 'assets/images/roundtrip.png' + : 'assets/images/carspeed.png', // Default image if none of the above width: 80, ), Column( @@ -176,11 +193,12 @@ class ApplyOrderWidget extends StatelessWidget { onTap: () { FirebaseMessagesController() .sendNotificationToAnyWithoutData( - 'message From passenger', - 'Hello, I\'m at the agreed-upon location' - .tr, - controller - .driverToken); + 'message From passenger', + 'Hello, I\'m at the agreed-upon location' + .tr, + controller.driverToken, + 'ding.wav', + ); Get.back(); }, child: Container( @@ -202,11 +220,12 @@ class ApplyOrderWidget extends StatelessWidget { onTap: () { FirebaseMessagesController() .sendNotificationToAnyWithoutData( - 'message From passenger', - 'My location is correct. You can search for me using the navigation app' - .tr, - controller - .driverToken); + 'message From passenger', + 'My location is correct. You can search for me using the navigation app' + .tr, + controller.driverToken, + 'ding.wav', + ); Get.back(); }, child: Container( @@ -228,11 +247,11 @@ class ApplyOrderWidget extends StatelessWidget { onTap: () { FirebaseMessagesController() .sendNotificationToAnyWithoutData( - 'message From passenger', - 'I\'m waiting for you' - .tr, - controller - .driverToken); + 'message From passenger', + 'I\'m waiting for you'.tr, + controller.driverToken, + 'ding.wav', + ); Get.back(); }, child: Container( @@ -260,10 +279,11 @@ class ApplyOrderWidget extends StatelessWidget { ), ), IconButton( - onPressed: () { + onPressed: () async { HapticFeedback.heavyImpact(); // Get.to(() => const CallPage()); // Get.to(() => PassengerCallPage()); + makePhoneCall(controller.driverPhone); }, icon: const Icon( Icons.call, diff --git a/lib/views/home/map_widget.dart/call_passenger_page.dart b/lib/views/home/map_widget.dart/call_passenger_page.dart index b6fc978..62730c1 100644 --- a/lib/views/home/map_widget.dart/call_passenger_page.dart +++ b/lib/views/home/map_widget.dart/call_passenger_page.dart @@ -180,9 +180,7 @@ class _PassengerCallPageState extends State { status, style: AppStyle.title, ), - Text(Get.find() - .driverName - .toString()), + Text('Driver Name'), ], ), GestureDetector( @@ -193,6 +191,7 @@ class _PassengerCallPageState extends State { 'Call End', Get.find().driverToken, [], + 'iphone_ringtone.wav', ); leave(); Get.back(); diff --git a/lib/views/home/map_widget.dart/car_details_widget_to_go.dart b/lib/views/home/map_widget.dart/car_details_widget_to_go.dart index 31859d7..fa0ddcd 100644 --- a/lib/views/home/map_widget.dart/car_details_widget_to_go.dart +++ b/lib/views/home/map_widget.dart/car_details_widget_to_go.dart @@ -2,7 +2,9 @@ import 'package:SEFER/constant/box_name.dart'; import 'package:SEFER/constant/colors.dart'; import 'package:SEFER/constant/style.dart'; import 'package:SEFER/main.dart'; +import 'package:SEFER/views/home/profile/passenger_profile_page.dart'; import 'package:SEFER/views/widgets/elevated_btn.dart'; +import 'package:SEFER/views/widgets/my_dialog.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -440,11 +442,22 @@ class CarDetailsTypeToChoose extends StatelessWidget { title: 'Next'.tr, onPressed: () { Get.back(); - mapPassengerController - .isBottomSheetShown = false; - mapPassengerController.update(); - mapPassengerController - .changeCashConfirmPageShown(); + if (box.read(BoxName.gender) != + null) { + mapPassengerController + .isBottomSheetShown = false; + mapPassengerController.update(); + mapPassengerController + .changeCashConfirmPageShown(); + } else { + MyDialog().getDialog( + 'Idintify gender', + 'You should ideintify your gender for this type of trip!' + .tr, () { + Get.to(() => + PassengerProfilePage()); + }); + } }), cancel: MyElevatedButton( title: 'Cancel'.tr, @@ -577,32 +590,35 @@ class HeaderDestination extends StatelessWidget { mapPassengerController.isBottomSheetShown && mapPassengerController.rideConfirm == false ? Positioned( - top: Get.height * .1, + top: Get.height * .08, left: 5, right: 5, child: Container( decoration: AppStyle.boxDecoration1, - height: box.read(BoxName.countryCode) == 'Egypt' - ? Get.height * .2 - : Get.height * .14, + height: Get.height * .1, width: Get.width * .8, child: InkWell( onTap: () { - mapPassengerController - .getDialog('Are you want to change'.tr, '', () { + // mapPassengerController + // .getDialog('Are you want to change'.tr, '', () { + // Get.back(); + // mapPassengerController.cancelRide(); + // }); + MyDialog().getDialog( + 'Change Ride'.tr, + 'You can change the destination by long-pressing any point on the map' + .tr, () { Get.back(); - mapPassengerController.cancelRide(); }); }, child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Padding( - padding: const EdgeInsets.all(8.0), + padding: const EdgeInsets.symmetric( + horizontal: 8, vertical: 2), child: SizedBox( - height: box.read(BoxName.countryCode) == 'Egypt' - ? Get.height * .14 - : Get.height * .06, + height: Get.height * .06, child: ListView( // crossAxisAlignment: CrossAxisAlignment.start, // @@ -616,7 +632,7 @@ class HeaderDestination extends StatelessWidget { style: AppStyle.subtitle, ), SizedBox( - height: Get.height * .06, + // height: Get.height * .03, width: Get.width * .8, child: Text( mapPassengerController.startNameAddress, @@ -634,7 +650,7 @@ class HeaderDestination extends StatelessWidget { style: AppStyle.subtitle, ), SizedBox( - height: Get.height * .06, + // height: Get.height * .03, width: Get.width * .8, child: Text( mapPassengerController.endNameAddress, @@ -647,13 +663,24 @@ class HeaderDestination extends StatelessWidget { ), ), ), - Row( - children: [ - Text( - '📍 ${mapPassengerController.distance} ${'KM'.tr} ⌛ ${mapPassengerController.hours > 0 ? '${'Your Ride Duration is '.tr}${mapPassengerController.hours} ${'H and'.tr} ${mapPassengerController.minutes} ${'m'.tr}' : '${'Your Ride Duration is '.tr} ${mapPassengerController.minutes} ${'m'.tr}'}', - style: AppStyle.subtitle, - ), - ], + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + '📍 ', + style: AppStyle.subtitle, + ), + SizedBox( + width: Get.width * .8, + child: Text( + '${mapPassengerController.distance} ${'KM'.tr} ⌛ ${mapPassengerController.hours > 0 ? '${'Your Ride Duration is '.tr}${mapPassengerController.hours} ${'H and'.tr} ${mapPassengerController.minutes} ${'m'.tr}' : '${'Your Ride Duration is '.tr} ${mapPassengerController.minutes} ${'m'.tr}'}', + style: AppStyle.subtitle, + ), + ), + ], + ), ), ], ), diff --git a/lib/views/home/map_widget.dart/form_search_places_destenation.dart b/lib/views/home/map_widget.dart/form_search_places_destenation.dart index e8a7fbe..525e642 100644 --- a/lib/views/home/map_widget.dart/form_search_places_destenation.dart +++ b/lib/views/home/map_widget.dart/form_search_places_destenation.dart @@ -134,7 +134,8 @@ GetBuilder formSearchPlacesDestenation() { }, onLongPress: () { Get.defaultDialog( - title: 'Do you want to change Work location', + title: + 'Do you want to change Work location'.tr, middleText: '', confirm: MyElevatedButton( title: 'Yes'.tr, diff --git a/lib/views/home/map_widget.dart/left_main_menu_icons.dart b/lib/views/home/map_widget.dart/left_main_menu_icons.dart index ffd800c..120ba26 100644 --- a/lib/views/home/map_widget.dart/left_main_menu_icons.dart +++ b/lib/views/home/map_widget.dart/left_main_menu_icons.dart @@ -4,6 +4,7 @@ import 'package:get/get.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import '../../../constant/box_name.dart'; import '../../../constant/colors.dart'; +import '../../../controller/functions/launch.dart'; import '../../../controller/functions/tts.dart'; import '../../../controller/home/map_passenger_controller.dart'; @@ -82,26 +83,23 @@ GetBuilder leftMainMenuIcons() { const SizedBox( width: 5, ), - // AnimatedContainer( - // duration: const Duration(microseconds: 200), - // width: controller.widthMapTypeAndTraffic, - // decoration: BoxDecoration( - // color: AppColor.secondaryColor, - // border: Border.all(), - // borderRadius: BorderRadius.circular(15)), - // child: IconButton( - // onPressed: () async { - // // AudioRecorderController audioController = - // // Get.put(AudioRecorderController()); - // // sql.deleteAllData(TableName.recentLocations); - // // await audioController.startRecording(); - // }, - // icon: const Icon( - // Icons.voice_chat, - // size: 29, - // ), - // ), - // ), + AnimatedContainer( + duration: const Duration(microseconds: 200), + width: controller.widthMapTypeAndTraffic, + decoration: BoxDecoration( + color: AppColor.secondaryColor, + border: Border.all(), + borderRadius: BorderRadius.circular(15)), + child: IconButton( + onPressed: () async { + makePhoneCall('+201023248456'); + }, + icon: const Icon( + Icons.voice_chat, + size: 29, + ), + ), + ), // AnimatedContainer( // duration: const Duration(microseconds: 200), // width: controller.widthMapTypeAndTraffic, diff --git a/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart b/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart index 211e062..3acfe04 100644 --- a/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart +++ b/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart @@ -1,3 +1,4 @@ +import 'package:SEFER/views/widgets/my_textField.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -139,6 +140,92 @@ class MainBottomMenuMap extends StatelessWidget { // }), //todo If you want add stop click here + InkWell( + onTap: () { + Get.dialog( + Dialog( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(16)), + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + 'WhatsApp Location Extractor' + .tr, + style: AppStyle.title, + ), + const SizedBox(height: 16), + Form( + key: controller.sosFormKey, + child: Column( + children: [ + MyTextForm( + controller: controller + .whatsAppLocationText, + label: + 'Location Link'.tr, + hint: + 'Paste location link here' + .tr, + type: TextInputType.url, + ), + const SizedBox( + height: 16), + MyElevatedButton( + title: + 'Go to this location' + .tr, + onPressed: () async { + controller + .goToWhatappLocation(); + }, + ) + ], + ), + ), + ], + ), + ), + ), + ); + }, + child: Container( + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [ + Colors.blue[300]!, + Colors.blue[600]! + ], + begin: Alignment.topLeft, + end: Alignment.bottomRight, + ), + borderRadius: BorderRadius.circular(12), + boxShadow: const [ + BoxShadow( + color: Colors.black26, + offset: Offset(0, 4), + blurRadius: 5.0, + ), + ], + ), + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Text( + 'Paste WhatsApp location link here' + .tr, + style: const TextStyle( + color: Colors.white, + fontSize: 16, + fontWeight: FontWeight.bold, + ), + textAlign: TextAlign.center, + ), + ), + ), + ), CupertinoButton( child: Text( !controller.isAnotherOreder @@ -358,6 +445,20 @@ class MainBottomMenuMap extends StatelessWidget { Get.back(); })); } else {} + if (controller.isWhatsAppOrder == true) { + Get.defaultDialog( + title: 'Destination selected'.tr, + titleStyle: AppStyle.title, + content: Text( + 'Now select start pick'.tr, + style: AppStyle.title, + ), + confirm: MyElevatedButton( + title: 'OK'.tr, + onPressed: () { + Get.back(); + })); + } else {} } controller.placesDestination = []; diff --git a/pubspec.yaml b/pubspec.yaml index 1ac0380..50b95cb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -21,7 +21,7 @@ dependencies: http: ^0.13.6 get: ^4.6.5 get_storage: ^2.1.1 - url_launcher: ^6.1.12 + url_launcher: ^6.1.20 location: ^5.0.2+1 google_polyline_algorithm: ^3.1.0 animated_text_kit: ^4.2.2