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.
minSdkVersion 23
targetSdkVersion 33
versionCode 40
versionName '1.5.40'
versionCode 42
versionName '1.5.42'
// 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.USE_BIOMETRIC" />
<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_MEDIA_PROJECTION" />

Binary file not shown.

View File

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

View File

@@ -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';

View File

@@ -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";

View File

@@ -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: {

View File

@@ -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<MapPassengerController>().getBeginRideFromDriver();
@@ -332,7 +338,9 @@ class FirebaseMessagesController extends GetxController {
FirebaseMessagesController().sendNotificationToPassengerToken(
'Hi ,I will go now'.tr,
'I will go now'.tr,
Get.find<MapPassengerController>().driverToken, []);
Get.find<MapPassengerController>().driverToken,
[],
'ding.wav');
Get.find<MapPassengerController>()
.startTimerDriverWaitPassenger5Minute();
@@ -412,7 +420,7 @@ class FirebaseMessagesController extends GetxController {
'notification': <String, dynamic>{
'title': title,
'body': body,
'sound': 'start.wav'
'sound': 'ding.wav'
},
'priority': 'high',
'data': <String, dynamic>{
@@ -455,7 +463,7 @@ class FirebaseMessagesController extends GetxController {
// }
void sendNotificationToPassengerToken(
String title, body, token, List<String> map) async {
String title, body, token, List<String> 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': <String, dynamic>{
'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': <String, dynamic>{
'title': title,
'body': body,
'sound': 'promo.wav'
'sound': tone
},
'data': <String, dynamic>{
'click_action': 'FLUTTER_NOTIFICATION_CLICK',
@@ -524,8 +532,8 @@ class FirebaseMessagesController extends GetxController {
}
}
void sendNotificationToDriverMAP(
String title, String body, String token, List<String> data) async {
void sendNotificationToDriverMAP(String title, String body, String token,
List<String> 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,

View File

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

View File

@@ -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') {

View File

@@ -7,6 +7,14 @@ void showInBrowser(String url) async {
} else {}
}
Future<void> 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;

View File

@@ -44,6 +44,7 @@ class MapPassengerController extends GetxController {
TextEditingController wayPoint3Controller = TextEditingController();
TextEditingController wayPoint4Controller = TextEditingController();
TextEditingController sosPhonePassengerProfile = TextEditingController();
TextEditingController whatsAppLocationText = TextEditingController();
final sosFormKey = GlobalKey<FormState>();
final increaseFeeFormKey = GlobalKey<FormState>();
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<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;
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<String> 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<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;
bool haveSteps = false;
late LatLng latestPosition;

View File

@@ -4,6 +4,15 @@ class MyTranslation extends Translations {
@override
Map<String, Map<String, String>> 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 ...": "في انتظار السائق...",

View File

@@ -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

View File

@@ -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();
}

View File

@@ -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<MapPassengerController>().totalPassenger)}',
Get.find<MapPassengerController>().driverToken.toString(),
'ding.wav',
);
}
}

View File

@@ -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(

View File

@@ -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<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()),
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,
);
}
}

View File

@@ -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,

View File

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

View File

@@ -134,7 +134,8 @@ GetBuilder<MapPassengerController> 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,

View File

@@ -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<MapPassengerController> 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,

View File

@@ -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 = [];

View File

@@ -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