This commit is contained in:
Hamza-Ayed
2024-06-30 13:27:23 +03:00
parent 08d31bc4d1
commit 176f5105b1
25 changed files with 465 additions and 154 deletions

View File

@@ -55,8 +55,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 23 minSdkVersion 23
targetSdkVersion 33 targetSdkVersion 33
versionCode 40 versionCode 42
versionName '1.5.40' versionName '1.5.42'
// manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml'] // manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml']
} }

View File

@@ -11,6 +11,7 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" /> <uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />

Binary file not shown.

View File

@@ -37,11 +37,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>36</string> <string>38</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>4.3.6</string> <string>4.3.8</string>
<key>FirebaseAppDelegateProxyEnabled</key> <key>FirebaseAppDelegateProxyEnabled</key>
<string>NO</string> <string>NO</string>
<key>GMSApiKey</key> <key>GMSApiKey</key>

View File

@@ -5,6 +5,7 @@ class BoxName {
static const String tokenParent = "tokenParent"; static const String tokenParent = "tokenParent";
static const String lang = "lang"; static const String lang = "lang";
static const String gender = "gender";
static const String carType = "carType"; static const String carType = "carType";
static const String carPlate = "carPlate"; static const String carPlate = "carPlate";
static const String isVerified = '0'; static const String isVerified = '0';

View File

@@ -163,6 +163,9 @@ class AppLink {
//==================certifcate========== //==================certifcate==========
static String location = '$server/ride/location'; static String location = '$server/ride/location';
static String getCarsLocationByPassenger = "$location/get.php"; 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 getLocationParents = "$location/getLocationParents.php";
static String getFemalDriverLocationByPassenger = static String getFemalDriverLocationByPassenger =
"$location/getFemalDriver.php"; "$location/getFemalDriver.php";

View File

@@ -53,7 +53,7 @@ class LoginController extends GetxController {
Get.offAll(SmsSignupEgypt()); Get.offAll(SmsSignupEgypt());
isloading = false; isloading = false;
update(); update();
Get.snackbar("User does not exist.".tr, '', backgroundColor: Colors.red); // Get.snackbar("User does not exist.".tr, '', backgroundColor: Colors.red);
} else { } else {
var jsonDecoeded = jsonDecode(res); var jsonDecoeded = jsonDecode(res);
if (jsonDecoeded.isNotEmpty) { if (jsonDecoeded.isNotEmpty) {
@@ -75,6 +75,7 @@ class LoginController extends GetxController {
'token change'.tr, 'token change'.tr,
'change device'.tr, 'change device'.tr,
jsonDecode(token)['data'][0]['token'].toString(), jsonDecode(token)['data'][0]['token'].toString(),
'cancel.wav',
); );
Future.delayed(const Duration(seconds: 1)); Future.delayed(const Duration(seconds: 1));
await CRUD().post(link: AppLink.addTokens, payload: { await CRUD().post(link: AppLink.addTokens, payload: {

View File

@@ -159,6 +159,12 @@ class FirebaseMessagesController extends GetxController {
.showNotification('message From passenger'.tr, ''.tr, 'tone2'); .showNotification('message From passenger'.tr, ''.tr, 'tone2');
passengerDialog(message.notification!.body!); 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(); update();
} else if (message.notification!.title! == 'RideIsBegin') { } else if (message.notification!.title! == 'RideIsBegin') {
Get.find<MapPassengerController>().getBeginRideFromDriver(); Get.find<MapPassengerController>().getBeginRideFromDriver();
@@ -332,7 +338,9 @@ class FirebaseMessagesController extends GetxController {
FirebaseMessagesController().sendNotificationToPassengerToken( FirebaseMessagesController().sendNotificationToPassengerToken(
'Hi ,I will go now'.tr, 'Hi ,I will go now'.tr,
'I will go now'.tr, 'I will go now'.tr,
Get.find<MapPassengerController>().driverToken, []); Get.find<MapPassengerController>().driverToken,
[],
'ding.wav');
Get.find<MapPassengerController>() Get.find<MapPassengerController>()
.startTimerDriverWaitPassenger5Minute(); .startTimerDriverWaitPassenger5Minute();
@@ -412,7 +420,7 @@ class FirebaseMessagesController extends GetxController {
'notification': <String, dynamic>{ 'notification': <String, dynamic>{
'title': title, 'title': title,
'body': body, 'body': body,
'sound': 'start.wav' 'sound': 'ding.wav'
}, },
'priority': 'high', 'priority': 'high',
'data': <String, dynamic>{ 'data': <String, dynamic>{
@@ -455,7 +463,7 @@ class FirebaseMessagesController extends GetxController {
// } // }
void sendNotificationToPassengerToken( void sendNotificationToPassengerToken(
String title, body, token, List<String> map) async { String title, body, token, List<String> map, String tone) async {
try { try {
final response = await http.post( final response = await http.post(
Uri.parse('https://fcm.googleapis.com/fcm/send'), Uri.parse('https://fcm.googleapis.com/fcm/send'),
@@ -467,7 +475,7 @@ class FirebaseMessagesController extends GetxController {
'notification': <String, dynamic>{ 'notification': <String, dynamic>{
'title': title, 'title': title,
'body': body, 'body': body,
'sound': 'tone2.wav' 'sound': tone
}, },
'data': { 'data': {
'passengerList': map, 'passengerList': map,
@@ -489,7 +497,7 @@ class FirebaseMessagesController extends GetxController {
} }
void sendNotificationToAnyWithoutData( void sendNotificationToAnyWithoutData(
String title, String body, String token) async { String title, String body, String token, String tone) async {
try { try {
final response = await http.post( final response = await http.post(
Uri.parse('https://fcm.googleapis.com/fcm/send'), Uri.parse('https://fcm.googleapis.com/fcm/send'),
@@ -501,7 +509,7 @@ class FirebaseMessagesController extends GetxController {
'notification': <String, dynamic>{ 'notification': <String, dynamic>{
'title': title, 'title': title,
'body': body, 'body': body,
'sound': 'promo.wav' 'sound': tone
}, },
'data': <String, dynamic>{ 'data': <String, dynamic>{
'click_action': 'FLUTTER_NOTIFICATION_CLICK', 'click_action': 'FLUTTER_NOTIFICATION_CLICK',
@@ -524,8 +532,8 @@ class FirebaseMessagesController extends GetxController {
} }
} }
void sendNotificationToDriverMAP( void sendNotificationToDriverMAP(String title, String body, String token,
String title, String body, String token, List<String> data) async { List<String> data, String tone) async {
try { try {
final response = await http.post( final response = await http.post(
Uri.parse('https://fcm.googleapis.com/fcm/send'), Uri.parse('https://fcm.googleapis.com/fcm/send'),
@@ -538,7 +546,7 @@ class FirebaseMessagesController extends GetxController {
'title': title, 'title': title,
'body': body, 'body': body,
// 'sound': 'tone2.wav', // 'sound': 'tone2.wav',
'sound': 'order.wav' 'sound': tone
}, },
'data': { 'data': {
'DriverList': data, 'DriverList': data,

View File

@@ -50,6 +50,7 @@ class CallController extends GetxController {
uid.toString(), uid.toString(),
remoteUid.toString(), remoteUid.toString(),
], ],
'iphone_ringtone.wav',
); );
join(); join();
} }

View File

@@ -27,6 +27,7 @@ class CRUD {
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}', 'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}',
}, },
); );
print(response.request);
// if (response.statusCode == 200) { // if (response.statusCode == 200) {
var jsonData = jsonDecode(response.body); var jsonData = jsonDecode(response.body);
if (jsonData['status'] == 'success') { if (jsonData['status'] == 'success') {

View File

@@ -7,6 +7,14 @@ void showInBrowser(String url) async {
} else {} } else {}
} }
Future<void> makePhoneCall(String phoneNumber) async {
final Uri launchUri = Uri(
scheme: 'tel',
path: phoneNumber,
);
await launchUrl(launchUri);
}
void launchCommunication( void launchCommunication(
String method, String contactInfo, String message) async { String method, String contactInfo, String message) async {
String url; String url;
@@ -35,6 +43,7 @@ void launchCommunication(
case 'phone': case 'phone':
url = 'tel:$contactInfo'; url = 'tel:$contactInfo';
break; break;
case 'sms': case 'sms':
url = 'sms:$contactInfo?body=${Uri.encodeComponent(message)}'; url = 'sms:$contactInfo?body=${Uri.encodeComponent(message)}';
break; break;

View File

@@ -44,6 +44,7 @@ class MapPassengerController extends GetxController {
TextEditingController wayPoint3Controller = TextEditingController(); TextEditingController wayPoint3Controller = TextEditingController();
TextEditingController wayPoint4Controller = TextEditingController(); TextEditingController wayPoint4Controller = TextEditingController();
TextEditingController sosPhonePassengerProfile = TextEditingController(); TextEditingController sosPhonePassengerProfile = TextEditingController();
TextEditingController whatsAppLocationText = TextEditingController();
final sosFormKey = GlobalKey<FormState>(); final sosFormKey = GlobalKey<FormState>();
final increaseFeeFormKey = GlobalKey<FormState>(); final increaseFeeFormKey = GlobalKey<FormState>();
List data = []; List data = [];
@@ -111,6 +112,7 @@ class MapPassengerController extends GetxController {
bool isDriverArrivePassenger = false; bool isDriverArrivePassenger = false;
bool startLocationFromMap = false; bool startLocationFromMap = false;
bool isAnotherOreder = false; bool isAnotherOreder = false;
bool isWhatsAppOrder = false;
bool passengerStartLocationFromMap = false; bool passengerStartLocationFromMap = false;
bool workLocationFromMap = false; bool workLocationFromMap = false;
bool homeLocationFromMap = false; bool homeLocationFromMap = false;
@@ -472,6 +474,11 @@ class MapPassengerController extends GetxController {
update(); update();
} }
void changeIsWhatsAppOrder(bool val) {
isWhatsAppOrder = val;
update();
}
void sendSMS(String to) async { void sendSMS(String to) async {
// Get the driver's phone number. // Get the driver's phone number.
String driverPhone = String driverPhone =
@@ -682,10 +689,11 @@ class MapPassengerController extends GetxController {
box.write(BoxName.passengerWalletTotal, '0'); box.write(BoxName.passengerWalletTotal, '0');
if (box.read(BoxName.parentTripSelected) == true) { if (box.read(BoxName.parentTripSelected) == true) {
FirebaseMessagesController().sendNotificationToPassengerToken( FirebaseMessagesController().sendNotificationToPassengerToken(
"Finish Monitor", "Finish Monitor".tr,
"Finish Monitor".tr, "Finish Monitor".tr,
box.read(BoxName.tokenParent), box.read(BoxName.tokenParent),
[], [],
'order1.wav',
); );
box.write(BoxName.parentTripSelected, false); box.write(BoxName.parentTripSelected, false);
box.remove(BoxName.tokenParent); box.remove(BoxName.tokenParent);
@@ -878,6 +886,72 @@ class MapPassengerController extends GetxController {
})); }));
} }
Map<String, double>? extractCoordinatesFromWhatsAppLink(String link) {
try {
Uri uri = Uri.parse(link);
if (uri.host == 'maps.google.com') {
String? query = uri.queryParameters['q'];
if (query != null) {
List<String> 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<String, double>? 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; int currentTimeSearchingCaptainWindow = 0;
late String driverPhone = ''; late String driverPhone = '';
late String driverRate = ''; late String driverRate = '';
@@ -939,7 +1013,8 @@ class MapPassengerController extends GetxController {
'carType': box.read(BoxName.carType), 'carType': box.read(BoxName.carType),
"price_for_driver": totalPassenger.toString(), "price_for_driver": totalPassenger.toString(),
"price_for_passenger": totalME.toString(), "price_for_passenger": totalME.toString(),
"distance": distance.toString() "distance": distance.toString(),
"paymentMethod": paymentController.isWalletChecked.toString(),
}).then((value) { }).then((value) {
// List<String> body = [ // List<String> body = [
rideId = jsonDecode(value)['message']; rideId = jsonDecode(value)['message'];
@@ -987,12 +1062,15 @@ class MapPassengerController extends GetxController {
passengerRate.toStringAsFixed(2), passengerRate.toStringAsFixed(2),
]; // ]; //
FirebaseMessagesController().sendNotificationToDriverMAP( FirebaseMessagesController().sendNotificationToDriverMAP(
'Order', 'Order'.tr,
jsonDecode(value)['message'].toString(), jsonDecode(value)['message'].toString(),
dataCarsLocationByPassenger['message'][carsOrder]['token'].toString(), dataCarsLocationByPassenger['message'][carsOrder]['token']
body, .toString(),
// polylineCoordinates.toString() body,
); 'order.wav'
// polylineCoordinates.toString()
);
}); });
delayAndFetchRideStatus(rideId); delayAndFetchRideStatus(rideId);
if (shouldFetch == false) { if (shouldFetch == false) {
@@ -1188,9 +1266,11 @@ class MapPassengerController extends GetxController {
driversToken.remove(driverToken); driversToken.remove(driverToken);
for (var i = 1; i < driversToken.length; i++) { for (var i = 1; i < driversToken.length; i++) {
FirebaseMessagesController().sendNotificationToAnyWithoutData( FirebaseMessagesController().sendNotificationToAnyWithoutData(
'Order Applied', 'Order Applied',
'$driverName Apply order\nTake attention in other order'.tr, '$driverName Apply order\nTake attention in other order'.tr,
driversToken[i]); driversToken[i],
'start.wav',
);
} }
// } // }
} }
@@ -1212,6 +1292,26 @@ class MapPassengerController extends GetxController {
'northeastLat': bounds.northeast.latitude.toString(), 'northeastLat': bounds.northeast.latitude.toString(),
'northeastLon': bounds.northeast.longitude.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 { } else {
res = await CRUD() res = await CRUD()
.get(link: AppLink.getCarsLocationByPassenger, payload: { .get(link: AppLink.getCarsLocationByPassenger, payload: {
@@ -1373,10 +1473,12 @@ class MapPassengerController extends GetxController {
} else if (res1['status'] == 'success') { } else if (res1['status'] == 'success') {
var tokenParent = res1['data'][0]['token']; var tokenParent = res1['data'][0]['token'];
FirebaseMessagesController().sendNotificationToPassengerToken( FirebaseMessagesController().sendNotificationToPassengerToken(
"Trip Monitoring", "Trip Monitoring".tr,
"Trip Monitoring".tr, "Trip Monitoring".tr,
tokenParent, tokenParent,
[rideId, driverId]); [rideId, driverId],
'order1.wav',
);
box.write(BoxName.parentTripSelected, true); box.write(BoxName.parentTripSelected, true);
box.write(BoxName.tokenParent, tokenParent); box.write(BoxName.tokenParent, tokenParent);
} }
@@ -1519,7 +1621,12 @@ class MapPassengerController extends GetxController {
"status": 'Cancel' "status": 'Cancel'
}); });
FirebaseMessagesController().sendNotificationToDriverMAP( FirebaseMessagesController().sendNotificationToDriverMAP(
'Cancel Trip', 'Trip Cancelled'.tr, driverToken, []); 'Cancel Trip'.tr,
'Trip Cancelled'.tr,
driverToken,
[],
'cancel.wav',
);
} }
// rideConfirm = false; // rideConfirm = false;
// shouldFetch = false; // shouldFetch = false;
@@ -2152,8 +2259,10 @@ class MapPassengerController extends GetxController {
data = response['routes'][0]['legs']; data = response['routes'][0]['legs'];
box.remove(BoxName.tripData); box.remove(BoxName.tripData);
box.write(BoxName.tripData, response); 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; isLoading = false;
newStartPointLocation = LatLng( newStartPointLocation = LatLng(
data[0]["start_location"]['lat'], data[0]["start_location"]['lng']); 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<String> 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; double distanceOfDestination = 0;
bool haveSteps = false; bool haveSteps = false;
late LatLng latestPosition; late LatLng latestPosition;

View File

@@ -4,6 +4,15 @@ class MyTranslation extends Translations {
@override @override
Map<String, Map<String, String>> get keys => { Map<String, Map<String, String>> get keys => {
"ar": { "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 from map destination": "حدد وجهتك على الخريطة",
"Pick or Tap to confirm": "حدد أو انقر للتأكيد", "Pick or Tap to confirm": "حدد أو انقر للتأكيد",
"Select Order Type": "حدد نوع الطلب", "Select Order Type": "حدد نوع الطلب",
@@ -765,6 +774,14 @@ iOS [https://getapp.cc/app/6458734951]
"Duration is": "المدة هي", "Duration is": "المدة هي",
"Leave": "مغادرة", "Leave": "مغادرة",
"Join": "الانضمام", "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.": "يجب أن تختار السبب.", "You Should be select reason.": "يجب أن تختار السبب.",
" \$": " دينار ", " \$": " دينار ",
"Waiting for Driver ...": "في انتظار السائق...", "Waiting for Driver ...": "في انتظار السائق...",

View File

@@ -53,8 +53,13 @@ class PassengerNotificationController extends GetxController {
'title': title, 'title': title,
'body': body, 'body': body,
}); });
FirebaseMessagesController() FirebaseMessagesController().sendNotificationToPassengerToken(
.sendNotificationToPassengerToken(title, body, 'token', []); title,
body,
'token',
[],
'iphone_ringtone.wav',
);
} }
@override @override

View File

@@ -14,7 +14,7 @@ class ProfileController extends GetxController {
bool isloading = false; bool isloading = false;
Map prfoileData = {}; Map prfoileData = {};
TextEditingController txtController = TextEditingController(); TextEditingController txtController = TextEditingController();
List genders = ['Male', 'Female', 'Non-binary']; List genders = ['Male', 'Female', 'Other'];
String gender = 'Male'; String gender = 'Male';
@@ -99,6 +99,10 @@ class ProfileController extends GetxController {
} else { } else {
var jsonDecoded = jsonDecode(res); var jsonDecoded = jsonDecode(res);
prfoileData = jsonDecoded['data']; 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; isloading = false;
update(); update();
} }

View File

@@ -71,9 +71,10 @@ class RateController extends GetxController {
}); });
if (res != 'failure') { if (res != 'failure') {
FirebaseMessagesController().sendNotificationToAnyWithoutData( FirebaseMessagesController().sendNotificationToAnyWithoutData(
'You Have Tips', 'You Have Tips'.tr,
'${'${tip.toString()}\$${' tips\nTotal is'.tr}'} ${tip + (Get.find<MapPassengerController>().totalPassenger)}', '${'${tip.toString()}\$${' tips\nTotal is'.tr}'} ${tip + (Get.find<MapPassengerController>().totalPassenger)}',
Get.find<MapPassengerController>().driverToken.toString(), Get.find<MapPassengerController>().driverToken.toString(),
'ding.wav',
); );
} }
} }

View File

@@ -1,7 +1,5 @@
import 'dart:io'; 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:firebase_auth/firebase_auth.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -88,15 +86,17 @@ class LoginPage extends StatelessWidget {
if (user != null) { if (user != null) {
box.write(BoxName.passengerID, user.uid); box.write(BoxName.passengerID, user.uid);
box.write(BoxName.email, user.email); box.write(BoxName.email, user.email);
await Get.put(LoginController()) await controller.loginUsingCredentials(
.loginUsingCredentials(
box box
.read(BoxName.passengerID) .read(BoxName.passengerID)
.toString(), .toString(),
box.read(BoxName.email).toString(), box.read(BoxName.email).toString(),
); );
// Navigate to another screen or perform other actions // Navigate to another screen or perform other actions
} else {} } else {
Get.snackbar('user not found'.tr, '',
backgroundColor: AppColor.redColor);
}
}, },
child: Container( child: Container(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(

View File

@@ -74,51 +74,18 @@ class SmsSignupEgypt extends StatelessWidget {
height: 10, height: 10,
), ),
if (registerController.isSent) if (registerController.isSent)
Obx(() => Column( Padding(
children: [ padding: const EdgeInsets.all(16.0),
Padding( child: registerController.isSent
padding: const EdgeInsets.symmetric(horizontal: 16.0), ? Form(
child: registerController.remainingTime > 0 key: registerController.formKey3,
? Column( child: MyTextForm(
children: [ controller: registerController.verifyCode,
Text( label: '5 digit'.tr,
'${(registerController.remainingTime / 60).floor()}:${(registerController.remainingTime % 60).toString().padLeft(2, '0')} remaining', hint: '5 digit'.tr,
style: AppStyle.subtitle, type: TextInputType.number),
textAlign: TextAlign.center, )
), : const SizedBox()),
const SizedBox(height: 8),
LinearProgressIndicator(
value: registerController.remainingTime /
300, // Assuming 300 seconds (5 minutes) total
backgroundColor: Colors.grey[300],
valueColor: AlwaysStoppedAnimation<Color>(
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()),
// Submit button // Submit button
MyElevatedButton( MyElevatedButton(
onPressed: () async { onPressed: () async {
@@ -132,7 +99,7 @@ class SmsSignupEgypt extends StatelessWidget {
); );
}), }),
], ],
isleading: true, isleading: false,
); );
} }
} }

View File

@@ -9,6 +9,7 @@ import 'package:flutter/services.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../constant/box_name.dart'; import '../../../constant/box_name.dart';
import '../../../controller/functions/launch.dart';
class ApplyOrderWidget extends StatelessWidget { class ApplyOrderWidget extends StatelessWidget {
const ApplyOrderWidget({super.key}); const ApplyOrderWidget({super.key});
@@ -108,7 +109,23 @@ class ApplyOrderWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Image.asset( 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, width: 80,
), ),
Column( Column(
@@ -176,11 +193,12 @@ class ApplyOrderWidget extends StatelessWidget {
onTap: () { onTap: () {
FirebaseMessagesController() FirebaseMessagesController()
.sendNotificationToAnyWithoutData( .sendNotificationToAnyWithoutData(
'message From passenger', 'message From passenger',
'Hello, I\'m at the agreed-upon location' 'Hello, I\'m at the agreed-upon location'
.tr, .tr,
controller controller.driverToken,
.driverToken); 'ding.wav',
);
Get.back(); Get.back();
}, },
child: Container( child: Container(
@@ -202,11 +220,12 @@ class ApplyOrderWidget extends StatelessWidget {
onTap: () { onTap: () {
FirebaseMessagesController() FirebaseMessagesController()
.sendNotificationToAnyWithoutData( .sendNotificationToAnyWithoutData(
'message From passenger', 'message From passenger',
'My location is correct. You can search for me using the navigation app' 'My location is correct. You can search for me using the navigation app'
.tr, .tr,
controller controller.driverToken,
.driverToken); 'ding.wav',
);
Get.back(); Get.back();
}, },
child: Container( child: Container(
@@ -228,11 +247,11 @@ class ApplyOrderWidget extends StatelessWidget {
onTap: () { onTap: () {
FirebaseMessagesController() FirebaseMessagesController()
.sendNotificationToAnyWithoutData( .sendNotificationToAnyWithoutData(
'message From passenger', 'message From passenger',
'I\'m waiting for you' 'I\'m waiting for you'.tr,
.tr, controller.driverToken,
controller 'ding.wav',
.driverToken); );
Get.back(); Get.back();
}, },
child: Container( child: Container(
@@ -260,10 +279,11 @@ class ApplyOrderWidget extends StatelessWidget {
), ),
), ),
IconButton( IconButton(
onPressed: () { onPressed: () async {
HapticFeedback.heavyImpact(); HapticFeedback.heavyImpact();
// Get.to(() => const CallPage()); // Get.to(() => const CallPage());
// Get.to(() => PassengerCallPage()); // Get.to(() => PassengerCallPage());
makePhoneCall(controller.driverPhone);
}, },
icon: const Icon( icon: const Icon(
Icons.call, Icons.call,

View File

@@ -180,9 +180,7 @@ class _PassengerCallPageState extends State<PassengerCallPage> {
status, status,
style: AppStyle.title, style: AppStyle.title,
), ),
Text(Get.find<MapPassengerController>() Text('Driver Name'),
.driverName
.toString()),
], ],
), ),
GestureDetector( GestureDetector(
@@ -193,6 +191,7 @@ class _PassengerCallPageState extends State<PassengerCallPage> {
'Call End', 'Call End',
Get.find<MapPassengerController>().driverToken, Get.find<MapPassengerController>().driverToken,
[], [],
'iphone_ringtone.wav',
); );
leave(); leave();
Get.back(); Get.back();

View File

@@ -2,7 +2,9 @@ import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/constant/colors.dart'; import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/style.dart'; import 'package:SEFER/constant/style.dart';
import 'package:SEFER/main.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/elevated_btn.dart';
import 'package:SEFER/views/widgets/my_dialog.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@@ -440,11 +442,22 @@ class CarDetailsTypeToChoose extends StatelessWidget {
title: 'Next'.tr, title: 'Next'.tr,
onPressed: () { onPressed: () {
Get.back(); Get.back();
mapPassengerController if (box.read(BoxName.gender) !=
.isBottomSheetShown = false; null) {
mapPassengerController.update(); mapPassengerController
mapPassengerController .isBottomSheetShown = false;
.changeCashConfirmPageShown(); 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( cancel: MyElevatedButton(
title: 'Cancel'.tr, title: 'Cancel'.tr,
@@ -577,32 +590,35 @@ class HeaderDestination extends StatelessWidget {
mapPassengerController.isBottomSheetShown && mapPassengerController.isBottomSheetShown &&
mapPassengerController.rideConfirm == false mapPassengerController.rideConfirm == false
? Positioned( ? Positioned(
top: Get.height * .1, top: Get.height * .08,
left: 5, left: 5,
right: 5, right: 5,
child: Container( child: Container(
decoration: AppStyle.boxDecoration1, decoration: AppStyle.boxDecoration1,
height: box.read(BoxName.countryCode) == 'Egypt' height: Get.height * .1,
? Get.height * .2
: Get.height * .14,
width: Get.width * .8, width: Get.width * .8,
child: InkWell( child: InkWell(
onTap: () { onTap: () {
mapPassengerController // mapPassengerController
.getDialog('Are you want to change'.tr, '', () { // .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(); Get.back();
mapPassengerController.cancelRide();
}); });
}, },
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.symmetric(
horizontal: 8, vertical: 2),
child: SizedBox( child: SizedBox(
height: box.read(BoxName.countryCode) == 'Egypt' height: Get.height * .06,
? Get.height * .14
: Get.height * .06,
child: ListView( child: ListView(
// crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
// //
@@ -616,7 +632,7 @@ class HeaderDestination extends StatelessWidget {
style: AppStyle.subtitle, style: AppStyle.subtitle,
), ),
SizedBox( SizedBox(
height: Get.height * .06, // height: Get.height * .03,
width: Get.width * .8, width: Get.width * .8,
child: Text( child: Text(
mapPassengerController.startNameAddress, mapPassengerController.startNameAddress,
@@ -634,7 +650,7 @@ class HeaderDestination extends StatelessWidget {
style: AppStyle.subtitle, style: AppStyle.subtitle,
), ),
SizedBox( SizedBox(
height: Get.height * .06, // height: Get.height * .03,
width: Get.width * .8, width: Get.width * .8,
child: Text( child: Text(
mapPassengerController.endNameAddress, mapPassengerController.endNameAddress,
@@ -647,13 +663,24 @@ class HeaderDestination extends StatelessWidget {
), ),
), ),
), ),
Row( Padding(
children: [ padding: const EdgeInsets.symmetric(horizontal: 8),
Text( child: Row(
'📍 ${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}'}', mainAxisAlignment: MainAxisAlignment.spaceBetween,
style: AppStyle.subtitle, 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,
),
),
],
),
), ),
], ],
), ),

View File

@@ -134,7 +134,8 @@ GetBuilder<MapPassengerController> formSearchPlacesDestenation() {
}, },
onLongPress: () { onLongPress: () {
Get.defaultDialog( Get.defaultDialog(
title: 'Do you want to change Work location', title:
'Do you want to change Work location'.tr,
middleText: '', middleText: '',
confirm: MyElevatedButton( confirm: MyElevatedButton(
title: 'Yes'.tr, title: 'Yes'.tr,

View File

@@ -4,6 +4,7 @@ import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import '../../../constant/box_name.dart'; import '../../../constant/box_name.dart';
import '../../../constant/colors.dart'; import '../../../constant/colors.dart';
import '../../../controller/functions/launch.dart';
import '../../../controller/functions/tts.dart'; import '../../../controller/functions/tts.dart';
import '../../../controller/home/map_passenger_controller.dart'; import '../../../controller/home/map_passenger_controller.dart';
@@ -82,26 +83,23 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
const SizedBox( const SizedBox(
width: 5, width: 5,
), ),
// AnimatedContainer( AnimatedContainer(
// duration: const Duration(microseconds: 200), duration: const Duration(microseconds: 200),
// width: controller.widthMapTypeAndTraffic, width: controller.widthMapTypeAndTraffic,
// decoration: BoxDecoration( decoration: BoxDecoration(
// color: AppColor.secondaryColor, color: AppColor.secondaryColor,
// border: Border.all(), border: Border.all(),
// borderRadius: BorderRadius.circular(15)), borderRadius: BorderRadius.circular(15)),
// child: IconButton( child: IconButton(
// onPressed: () async { onPressed: () async {
// // AudioRecorderController audioController = makePhoneCall('+201023248456');
// // Get.put(AudioRecorderController()); },
// // sql.deleteAllData(TableName.recentLocations); icon: const Icon(
// // await audioController.startRecording(); Icons.voice_chat,
// }, size: 29,
// icon: const Icon( ),
// Icons.voice_chat, ),
// size: 29, ),
// ),
// ),
// ),
// AnimatedContainer( // AnimatedContainer(
// duration: const Duration(microseconds: 200), // duration: const Duration(microseconds: 200),
// width: controller.widthMapTypeAndTraffic, // width: controller.widthMapTypeAndTraffic,

View File

@@ -1,3 +1,4 @@
import 'package:SEFER/views/widgets/my_textField.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@@ -139,6 +140,92 @@ class MainBottomMenuMap extends StatelessWidget {
// }), // }),
//todo If you want add stop click here //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( CupertinoButton(
child: Text( child: Text(
!controller.isAnotherOreder !controller.isAnotherOreder
@@ -358,6 +445,20 @@ class MainBottomMenuMap extends StatelessWidget {
Get.back(); Get.back();
})); }));
} else {} } 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 = []; controller.placesDestination = [];

View File

@@ -21,7 +21,7 @@ dependencies:
http: ^0.13.6 http: ^0.13.6
get: ^4.6.5 get: ^4.6.5
get_storage: ^2.1.1 get_storage: ^2.1.1
url_launcher: ^6.1.12 url_launcher: ^6.1.20
location: ^5.0.2+1 location: ^5.0.2+1
google_polyline_algorithm: ^3.1.0 google_polyline_algorithm: ^3.1.0
animated_text_kit: ^4.2.2 animated_text_kit: ^4.2.2