7/5/1
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:SEFER/constant/info.dart';
|
||||
import 'package:SEFER/controller/firebase/firbase_messge.dart';
|
||||
import 'package:SEFER/views/auth/login_page.dart';
|
||||
import 'package:SEFER/views/auth/sms_verfy_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/links.dart';
|
||||
import 'package:SEFER/controller/functions/crud.dart';
|
||||
import 'package:SEFER/controller/functions/secure_storage.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:SEFER/views/auth/verify_email_page.dart';
|
||||
import 'package:SEFER/views/home/map_page_passenger.dart';
|
||||
import 'package:location/location.dart';
|
||||
|
||||
@@ -24,12 +23,30 @@ class LoginController extends GetxController {
|
||||
TextEditingController adminNameController = TextEditingController();
|
||||
bool isAgreeTerms = false;
|
||||
bool isloading = false;
|
||||
|
||||
late int isTest = 1;
|
||||
void changeAgreeTerm() {
|
||||
isAgreeTerms = !isAgreeTerms;
|
||||
update();
|
||||
}
|
||||
|
||||
getAppTester(String appPlatform) async {
|
||||
var res = await CRUD()
|
||||
.get(link: AppLink.getTesterApp, payload: {'appPlatform': appPlatform});
|
||||
if (res != 'failure') {
|
||||
var d = jsonDecode(res);
|
||||
|
||||
isTest = d['message'][0]['isTest'];
|
||||
update();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
updateAppTester(String appPlatform) async {
|
||||
await CRUD().post(
|
||||
link: AppLink.updateTesterApp, payload: {'appPlatform': appPlatform});
|
||||
}
|
||||
|
||||
void saveAgreementTerms() {
|
||||
box.write(BoxName.agreeTerms, 'agreed');
|
||||
update();
|
||||
@@ -49,7 +66,6 @@ class LoginController extends GetxController {
|
||||
'id': passengerID,
|
||||
});
|
||||
if (res == 'Failure') {
|
||||
//Failure
|
||||
Get.offAll(SmsSignupEgypt());
|
||||
isloading = false;
|
||||
update();
|
||||
@@ -142,57 +158,41 @@ class LoginController extends GetxController {
|
||||
void login() async {
|
||||
isloading = true;
|
||||
update();
|
||||
var res = await CRUD().get(link: AppLink.login, payload: {
|
||||
'email': emailController.text,
|
||||
'phone': phoneController.text,
|
||||
'password': passwordController.text
|
||||
});
|
||||
var res = await CRUD().get(
|
||||
link: AppLink.loginFromGooglePassenger,
|
||||
payload: {
|
||||
'email': emailController.text,
|
||||
'id': passwordController.text
|
||||
});
|
||||
|
||||
isloading = false;
|
||||
update();
|
||||
if (res == 'Failure') {
|
||||
Get.snackbar('Failure', '', backgroundColor: Colors.red);
|
||||
//Failure
|
||||
Get.offAll(() => LoginPage());
|
||||
isloading = false;
|
||||
update();
|
||||
// Get.snackbar("User does not exist.".tr, '', backgroundColor: Colors.red);
|
||||
} else {
|
||||
var jsonDecoeded = jsonDecode(res);
|
||||
if (jsonDecoeded.isNotEmpty) {
|
||||
if (jsonDecoeded['status'] == 'success') {
|
||||
if (jsonDecoeded['data'][0]['verified'] == 1) {
|
||||
box.write(BoxName.passengerID, jsonDecoeded['data'][0]['id']);
|
||||
box.write(BoxName.email, jsonDecoeded['data'][0]['email']);
|
||||
box.write(
|
||||
BoxName.name,
|
||||
jsonDecoeded['data'][0]['first_name'] +
|
||||
' ' +
|
||||
jsonDecoeded['data'][0]['last_name']);
|
||||
box.write(BoxName.phone, jsonDecoeded['data'][0]['phone']);
|
||||
SecureStorage().saveData(BoxName.password, passwordController.text);
|
||||
Get.offAll(() => const MapPagePassenger());
|
||||
isloading = false;
|
||||
update();
|
||||
if (jsonDecoeded['status'] == 'success' &&
|
||||
jsonDecoeded['data'][0]['verified'] == 1) {
|
||||
//
|
||||
box.write(BoxName.isVerified, '1');
|
||||
box.write(BoxName.email, jsonDecoeded['data'][0]['email']);
|
||||
box.write(BoxName.phone, jsonDecoeded['data'][0]['phone']);
|
||||
box.write(BoxName.passengerID, passwordController.text);
|
||||
// var token = await CRUD().get(link: AppLink.getTokens, payload: {
|
||||
// 'passengerID': box.read(BoxName.passengerID).toString()
|
||||
// });
|
||||
await updateAppTester(AppInformation.appName);
|
||||
|
||||
await CRUD().post(link: AppLink.addTokens, payload: {
|
||||
'token': box.read(BoxName.tokenFCM),
|
||||
'passengerID': box.read(BoxName.passengerID).toString()
|
||||
});
|
||||
} else {
|
||||
isloading = false;
|
||||
update();
|
||||
Get.defaultDialog(
|
||||
title: 'You must Verify email !.'.tr,
|
||||
middleText: '',
|
||||
backgroundColor: Colors.yellow[300],
|
||||
onConfirm: () async {
|
||||
int randomNumber = Random().nextInt(100000) + 1;
|
||||
await CRUD().post(link: AppLink.sendVerifyEmail, payload: {
|
||||
'email': emailController.text,
|
||||
'token': randomNumber.toString(),
|
||||
});
|
||||
Get.to(() => const VerifyEmailPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
} else if (jsonDecoeded['status'] == 'Failure') {
|
||||
Get.snackbar(jsonDecoeded['status'], jsonDecoeded['data'],
|
||||
backgroundColor: Colors.redAccent);
|
||||
Get.offAll(() => const MapPagePassenger());
|
||||
} else {
|
||||
// Get.offAll(() => SmsSignupEgypt());
|
||||
// Get.snackbar(jsonDecoeded['status'], jsonDecoeded['data'],
|
||||
// backgroundColor: Colors.redAccent);
|
||||
isloading = false;
|
||||
update();
|
||||
}
|
||||
@@ -245,7 +245,11 @@ class LoginController extends GetxController {
|
||||
@override
|
||||
void onInit() async {
|
||||
// permissionLocation = await Permission.locationWhenInUse.isGranted;
|
||||
|
||||
await getAppTester(AppInformation.appName);
|
||||
if (isTest == 0 && box.read(BoxName.passengerID) != null) {
|
||||
await loginUsingCredentials(
|
||||
box.read(BoxName.passengerID), box.read(BoxName.email));
|
||||
}
|
||||
super.onInit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/views/home/map_page_passenger.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -88,18 +89,33 @@ class RegisterController extends GetxController {
|
||||
update();
|
||||
if (formKey3.currentState!.validate()) {
|
||||
if (box.read(BoxName.countryCode) == 'Egypt') {
|
||||
await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: {
|
||||
var responseCheker = await CRUD()
|
||||
.post(link: AppLink.checkPhoneNumberISVerfiedPassenger, payload: {
|
||||
'phone_number': '+2${phoneController.text}',
|
||||
'token': randomNumber.toString(),
|
||||
});
|
||||
if (responseCheker != 'failure') {
|
||||
var d = jsonDecode(responseCheker);
|
||||
if (d['message'][0]['verified'] == 1) {
|
||||
Get.snackbar('Phone number is verified before'.tr, '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
box.write(BoxName.isVerified, '1');
|
||||
box.write(BoxName.phone, '+2${phoneController.text}');
|
||||
Get.offAll(const MapPagePassenger());
|
||||
}
|
||||
} else {
|
||||
await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: {
|
||||
'phone_number': '+2${phoneController.text}',
|
||||
'token': randomNumber.toString(),
|
||||
});
|
||||
|
||||
await smsEgyptController.sendSmsEgypt(
|
||||
phoneController.text.toString(), randomNumber.toString());
|
||||
isSent = true;
|
||||
remainingTime = 300; // Reset to 5 minutes
|
||||
startTimer();
|
||||
isLoading = false;
|
||||
update();
|
||||
await smsEgyptController.sendSmsEgypt(
|
||||
phoneController.text.toString(), randomNumber.toString());
|
||||
isSent = true;
|
||||
remainingTime = 300; // Reset to 5 minutes
|
||||
startTimer();
|
||||
isLoading = false;
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,7 +145,7 @@ class RegisterController extends GetxController {
|
||||
link: AppLink.signUp,
|
||||
payload: payload,
|
||||
);
|
||||
if (jsonDecode(res1)['status'] == 'success') {
|
||||
if (res1 != 'failure') {
|
||||
box.write(BoxName.isVerified, '1');
|
||||
box.write(BoxName.phone, '+2${phoneController.text}');
|
||||
Get.offAll(const MapPagePassenger());
|
||||
|
||||
@@ -117,8 +117,8 @@ class FirebaseMessagesController extends GetxController {
|
||||
}
|
||||
|
||||
void fireBaseTitles(RemoteMessage message) {
|
||||
if (message.notification!.title! == 'Order') {
|
||||
} else if (message.notification!.title! == 'Apply Ride') {
|
||||
if (message.notification!.title! == 'Order'.tr) {
|
||||
} else if (message.notification!.title! == 'Apply Ride'.tr) {
|
||||
var passengerList = message.data['passengerList'];
|
||||
|
||||
var myList = jsonDecode(passengerList) as List<dynamic>;
|
||||
@@ -130,7 +130,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
NotificationController().showNotification(
|
||||
'Apply Order'.tr, 'Driver Applied the Ride for You'.tr, 'order1');
|
||||
// driverAppliedTripSnakBar();
|
||||
} else if (message.notification!.title! == 'Promo') {
|
||||
} else if (message.notification!.title! == 'Promo'.tr) {
|
||||
NotificationController()
|
||||
.showNotification('Promo', 'Show latest promo'.tr, 'promo');
|
||||
Get.to(const PromosPassengerPage());
|
||||
@@ -143,11 +143,11 @@ class FirebaseMessagesController extends GetxController {
|
||||
'rideId': myList[0].toString(),
|
||||
'driverId': myList[1].toString(),
|
||||
});
|
||||
} else if (message.notification!.title! == 'token change') {
|
||||
} else if (message.notification!.title! == 'token change'.tr) {
|
||||
NotificationController()
|
||||
.showNotification('token change', 'token change', 'cancel');
|
||||
.showNotification('token change'.tr, 'token change'.tr, 'cancel');
|
||||
GoogleSignInHelper.signOut();
|
||||
} else if (message.notification!.title! == 'DriverIsGoingToPassenger') {
|
||||
} else if (message.notification!.title! == 'DriverIsGoingToPassenger'.tr) {
|
||||
Get.find<MapPassengerController>().isDriverInPassengerWay = true;
|
||||
Get.find<MapPassengerController>().update();
|
||||
NotificationController().showNotification('Driver is Going To You'.tr,
|
||||
@@ -160,32 +160,32 @@ class FirebaseMessagesController extends GetxController {
|
||||
passengerDialog(message.notification!.body!);
|
||||
|
||||
update();
|
||||
} else if (message.notification!.title! == 'message From Driver'.tr) {
|
||||
} else if (message.notification!.title! == 'message From Driver') {
|
||||
NotificationController()
|
||||
.showNotification('message From passenger'.tr, ''.tr, 'tone2');
|
||||
passengerDialog(message.notification!.body!);
|
||||
|
||||
update();
|
||||
} else if (message.notification!.title! == 'RideIsBegin') {
|
||||
} else if (message.notification!.title! == 'RideIsBegin'.tr) {
|
||||
Get.find<MapPassengerController>().getBeginRideFromDriver();
|
||||
// Get.snackbar('RideIsBegin', '', backgroundColor: AppColor.greenColor);
|
||||
box.write(BoxName.passengerWalletTotal, '0');
|
||||
NotificationController()
|
||||
.showNotification('Trip is Begin'.tr, ''.tr, 'start');
|
||||
update();
|
||||
} else if (message.notification!.title! == 'Hi ,I will go now') {
|
||||
} else if (message.notification!.title! == 'Hi ,I will go now'.tr) {
|
||||
// Get.snackbar('Hi ,I will go now', '',
|
||||
// backgroundColor: AppColor.greenColor);
|
||||
NotificationController().showNotification(
|
||||
'Passenger come to you'.tr, 'Hi ,I will go now'.tr, 'tone2');
|
||||
update();
|
||||
} else if (message.notification!.title! == 'Hi ,I Arrive your site') {
|
||||
} else if (message.notification!.title! == 'Hi ,I Arrive your site'.tr) {
|
||||
NotificationController()
|
||||
.showNotification('Hi ,I Arrive your site'.tr, ''.tr, 'tone2');
|
||||
driverArrivePassengerDialoge();
|
||||
|
||||
update();
|
||||
} else if (message.notification!.title! == 'Driver Finish Trip') {
|
||||
} else if (message.notification!.title! == 'Driver Finish Trip'.tr) {
|
||||
var myListString = message.data['passengerList'];
|
||||
var driverList = jsonDecode(myListString) as List<dynamic>;
|
||||
NotificationController().showNotification(
|
||||
@@ -204,7 +204,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
'price': driverList[3].toString()
|
||||
});
|
||||
// }
|
||||
} else if (message.notification!.title! == "Finish Monitor") {
|
||||
} else if (message.notification!.title! == "Finish Monitor".tr) {
|
||||
Get.defaultDialog(
|
||||
titleStyle: AppStyle.title,
|
||||
title: 'Trip finished '.tr,
|
||||
@@ -214,6 +214,8 @@ class FirebaseMessagesController extends GetxController {
|
||||
onPressed: () {
|
||||
Get.offAll(() => const MapPagePassenger());
|
||||
}));
|
||||
} else if (message.notification!.title! == "Trip Monitoring".tr) {
|
||||
Get.to(() => const TripMonitor());
|
||||
} else if (message.notification!.title! == 'Call Income') {
|
||||
try {
|
||||
var myListString = message.data['passengerList'];
|
||||
@@ -232,7 +234,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
remoteID: driverList[2].toString(),
|
||||
));
|
||||
} catch (e) {}
|
||||
} else if (message.notification!.title! == 'Call Income from Driver') {
|
||||
} else if (message.notification!.title! == 'Call Income from Driver'.tr) {
|
||||
try {
|
||||
var myListString = message.data['passengerList'];
|
||||
var driverList = jsonDecode(myListString) as List<dynamic>;
|
||||
@@ -250,7 +252,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
remoteID: driverList[2].toString(),
|
||||
));
|
||||
} catch (e) {}
|
||||
} else if (message.notification!.title! == 'Call End') {
|
||||
} else if (message.notification!.title! == 'Call End'.tr) {
|
||||
try {
|
||||
var myListString = message.data['passengerList'];
|
||||
var driverList = jsonDecode(myListString) as List<dynamic>;
|
||||
@@ -264,7 +266,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
// Assuming GetMaterialApp is initialized and context is valid for navigation
|
||||
// Get.off(const CallPage());
|
||||
} catch (e) {}
|
||||
} else if (message.notification!.title! == 'Driver Cancel Your Trip') {
|
||||
} else if (message.notification!.title! == 'Driver Cancel Your Trip'.tr) {
|
||||
// Get.snackbar(
|
||||
// 'You will be pay the cost to driver or we will get it from you on next trip'
|
||||
// .tr,
|
||||
@@ -294,7 +296,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
// );
|
||||
// }
|
||||
|
||||
else if (message.notification!.title! == 'Order Applied') {
|
||||
else if (message.notification!.title! == 'Order Applied'.tr) {
|
||||
NotificationController().showNotification(
|
||||
'The order Accepted by another Driver'.tr,
|
||||
'We regret to inform you that another driver has accepted this order.'
|
||||
|
||||
@@ -28,6 +28,7 @@ class CRUD {
|
||||
},
|
||||
);
|
||||
print(response.request);
|
||||
print(response.body);
|
||||
// if (response.statusCode == 200) {
|
||||
var jsonData = jsonDecode(response.body);
|
||||
if (jsonData['status'] == 'success') {
|
||||
@@ -227,7 +228,8 @@ class CRUD {
|
||||
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
|
||||
},
|
||||
);
|
||||
|
||||
print(response.request);
|
||||
print(response.body);
|
||||
var jsonData = jsonDecode(response.body);
|
||||
if (response.statusCode == 200) {
|
||||
if (jsonData['status'] == 'success') {
|
||||
|
||||
@@ -45,7 +45,9 @@ class MapPassengerController extends GetxController {
|
||||
TextEditingController wayPoint4Controller = TextEditingController();
|
||||
TextEditingController sosPhonePassengerProfile = TextEditingController();
|
||||
TextEditingController whatsAppLocationText = TextEditingController();
|
||||
TextEditingController messageToDriver = TextEditingController();
|
||||
final sosFormKey = GlobalKey<FormState>();
|
||||
final messagesFormKey = GlobalKey<FormState>();
|
||||
final increaseFeeFormKey = GlobalKey<FormState>();
|
||||
List data = [];
|
||||
List<LatLng> bounds = [];
|
||||
@@ -96,6 +98,8 @@ class MapPassengerController extends GetxController {
|
||||
BitmapDescriptor startIcon = BitmapDescriptor.defaultMarker;
|
||||
BitmapDescriptor endIcon = BitmapDescriptor.defaultMarker;
|
||||
BitmapDescriptor carIcon = BitmapDescriptor.defaultMarker;
|
||||
BitmapDescriptor motoIcon = BitmapDescriptor.defaultMarker;
|
||||
BitmapDescriptor ladyIcon = BitmapDescriptor.defaultMarker;
|
||||
double height = 150;
|
||||
DateTime currentTime = DateTime.now();
|
||||
final location = Location();
|
||||
@@ -1235,6 +1239,7 @@ class MapPassengerController extends GetxController {
|
||||
void timerEnded() async {
|
||||
runEvery30SecondsUntilConditionMet();
|
||||
isCancelRidePageShown = false;
|
||||
print('isCancelRidePageShown: ${isCancelRidePageShown}');
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -1266,7 +1271,7 @@ class MapPassengerController extends GetxController {
|
||||
driversToken.remove(driverToken);
|
||||
for (var i = 1; i < driversToken.length; i++) {
|
||||
FirebaseMessagesController().sendNotificationToAnyWithoutData(
|
||||
'Order Applied',
|
||||
'Order Applied'.tr,
|
||||
'$driverName Apply order\nTake attention in other order'.tr,
|
||||
driversToken[i],
|
||||
'start.wav',
|
||||
@@ -1345,9 +1350,9 @@ class MapPassengerController extends GetxController {
|
||||
i < dataCarsLocationByPassenger['message'].length;
|
||||
i++) {
|
||||
var json = dataCarsLocationByPassenger['message'][i];
|
||||
CarLocationModel model = CarLocationModel.fromJson(json);
|
||||
// CarLocationModel model = CarLocationModel.fromJson(json);
|
||||
if (carLocationsModels.length < i + 1) {
|
||||
carLocationsModels.add(model);
|
||||
// carLocationsModels.add(model);
|
||||
markers.add(
|
||||
Marker(
|
||||
markerId: MarkerId(json['latitude']),
|
||||
@@ -1356,13 +1361,17 @@ class MapPassengerController extends GetxController {
|
||||
double.parse(json['longitude']),
|
||||
),
|
||||
rotation: double.parse(json['heading']),
|
||||
icon: carIcon,
|
||||
icon: json['model'].toString().contains('دراجة')
|
||||
? motoIcon
|
||||
: json['gender'] == 'Male'
|
||||
? carIcon
|
||||
: ladyIcon,
|
||||
),
|
||||
);
|
||||
driversToken.add(json['token']);
|
||||
// driversToken = json['token'];
|
||||
} else {
|
||||
carLocationsModels[i] = model;
|
||||
// carLocationsModels[i] = model;
|
||||
markers[i] = Marker(
|
||||
markerId: MarkerId(json['latitude']),
|
||||
position: LatLng(
|
||||
@@ -1370,7 +1379,11 @@ class MapPassengerController extends GetxController {
|
||||
double.parse(json['longitude']),
|
||||
),
|
||||
rotation: double.parse(json['heading']),
|
||||
icon: carIcon,
|
||||
icon: json['model'].contains('دراجة')
|
||||
? motoIcon
|
||||
: json['gender'] == 'Male'
|
||||
? carIcon
|
||||
: ladyIcon,
|
||||
);
|
||||
// driversToken = json['token'];
|
||||
driversToken.add(json['token']);
|
||||
@@ -1517,7 +1530,7 @@ class MapPassengerController extends GetxController {
|
||||
for (var i = 0; i < loopCount; i++) {
|
||||
// Wait for 50 seconds.
|
||||
await Future.delayed(const Duration(seconds: 4));
|
||||
if (rideTimerBegin == true) {
|
||||
if (rideTimerBegin == true || statusRide == 'Apply') {
|
||||
await getDriverCarsLocationToPassengerAfterApplied();
|
||||
}
|
||||
reloadMarkerDriverCarsLocationToPassengerAfterApplied();
|
||||
@@ -1566,8 +1579,16 @@ class MapPassengerController extends GetxController {
|
||||
rotation: double.parse(
|
||||
datadriverCarsLocationToPassengerAfterApplied['message'][0]
|
||||
['heading']),
|
||||
icon: carIcon,
|
||||
icon: datadriverCarsLocationToPassengerAfterApplied['message'][0]['model']
|
||||
.contains('دراجة')
|
||||
? motoIcon
|
||||
: datadriverCarsLocationToPassengerAfterApplied['message'][0]
|
||||
['gender'] ==
|
||||
'Male'
|
||||
? carIcon
|
||||
: ladyIcon, // Default to carIcon if gender is not Male or Female
|
||||
);
|
||||
|
||||
markers.add(driverAcceptedMarker);
|
||||
// update();
|
||||
mapController?.animateCamera(CameraUpdate.newLatLng(driverPosition));
|
||||
@@ -1620,8 +1641,9 @@ class MapPassengerController extends GetxController {
|
||||
"order_id": rideId.toString(), // Convert to String
|
||||
"status": 'Cancel'
|
||||
});
|
||||
print('Cancel');
|
||||
FirebaseMessagesController().sendNotificationToDriverMAP(
|
||||
'Cancel Trip'.tr,
|
||||
'Cancel Trip',
|
||||
'Trip Cancelled'.tr,
|
||||
driverToken,
|
||||
[],
|
||||
@@ -1922,6 +1944,28 @@ class MapPassengerController extends GetxController {
|
||||
});
|
||||
}
|
||||
|
||||
void addCustomMotoIcon() {
|
||||
ImageConfiguration config = ImageConfiguration(
|
||||
size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
|
||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/moto1.png',
|
||||
mipmaps: false)
|
||||
.then((value) {
|
||||
motoIcon = value;
|
||||
update();
|
||||
});
|
||||
}
|
||||
|
||||
void addCustomLadyIcon() {
|
||||
ImageConfiguration config = ImageConfiguration(
|
||||
size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
|
||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/lady1.png',
|
||||
mipmaps: false)
|
||||
.then((value) {
|
||||
ladyIcon = value;
|
||||
update();
|
||||
});
|
||||
}
|
||||
|
||||
void addCustomStepIcon() {
|
||||
ImageConfiguration config = ImageConfiguration(
|
||||
size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
|
||||
@@ -2253,7 +2297,7 @@ class MapPassengerController extends GetxController {
|
||||
isLoading = false;
|
||||
update();
|
||||
var url =
|
||||
('${AppLink.googleMapsLink}directions/json?&language=${box.read(BoxName.lang)}&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AK.mapAPIKEY}');
|
||||
('${AppLink.googleMapsLink}directions/json?&language=ar&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AK.mapAPIKEY}');
|
||||
|
||||
var response = await CRUD().getGoogleApi(link: url, payload: {});
|
||||
data = response['routes'][0]['legs'];
|
||||
@@ -2342,14 +2386,17 @@ class MapPassengerController extends GetxController {
|
||||
// Initialize the short address
|
||||
String shortAddress = '';
|
||||
|
||||
// Add the first part (usually the most specific location)
|
||||
if (parts.isNotEmpty) {
|
||||
// Add the first part (usually the most specific location)
|
||||
shortAddress += parts[0];
|
||||
}
|
||||
|
||||
// Add the district or area name (usually the third part in this format)
|
||||
if (parts.length > 2) {
|
||||
// Add the district or area name (usually the third part in Arabic format)
|
||||
shortAddress += '، ${parts[2]}';
|
||||
} else if (parts.length > 1) {
|
||||
// Add the second part for English or shorter addresses
|
||||
shortAddress += '، ${parts[1]}';
|
||||
}
|
||||
|
||||
// Add the country (usually the last part)
|
||||
@@ -2363,6 +2410,21 @@ class MapPassengerController extends GetxController {
|
||||
.where((part) => !RegExp(r'^[0-9 ]+$').hasMatch(part.trim()))
|
||||
.join('،');
|
||||
|
||||
// Check if the address is in English
|
||||
bool isEnglish =
|
||||
RegExp(r'^[a-zA-Z0-9 ]+$').hasMatch(shortAddress.replaceAll('،', ''));
|
||||
|
||||
if (isEnglish) {
|
||||
// Further processing for English addresses
|
||||
List<String> englishParts = shortAddress.split('،');
|
||||
if (englishParts.length > 2) {
|
||||
shortAddress =
|
||||
'${englishParts[0]}، ${englishParts[1]}، ${englishParts.last}';
|
||||
} else if (englishParts.length > 1) {
|
||||
shortAddress = '${englishParts[0]}، ${englishParts.last}';
|
||||
}
|
||||
}
|
||||
|
||||
return shortAddress;
|
||||
}
|
||||
|
||||
@@ -2809,6 +2871,8 @@ class MapPassengerController extends GetxController {
|
||||
readyWayPoints();
|
||||
addCustomPicker();
|
||||
addCustomCarIcon();
|
||||
addCustomLadyIcon();
|
||||
addCustomMotoIcon();
|
||||
addCustomStepIcon();
|
||||
addCustomStartIcon();
|
||||
addCustomEndIcon();
|
||||
|
||||
@@ -17,6 +17,8 @@ class TripMonitorController extends GetxController {
|
||||
late Timer timer;
|
||||
late LatLng parentLocation;
|
||||
BitmapDescriptor carIcon = BitmapDescriptor.defaultMarker;
|
||||
BitmapDescriptor motoIcon = BitmapDescriptor.defaultMarker;
|
||||
BitmapDescriptor ladyIcon = BitmapDescriptor.defaultMarker;
|
||||
double rotation = 0;
|
||||
double speed = 0;
|
||||
|
||||
@@ -65,6 +67,27 @@ class TripMonitorController extends GetxController {
|
||||
carIcon = value;
|
||||
update();
|
||||
});
|
||||
void addCustomMotoIcon() {
|
||||
ImageConfiguration config = ImageConfiguration(
|
||||
size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
|
||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/moto1.png',
|
||||
mipmaps: false)
|
||||
.then((value) {
|
||||
motoIcon = value;
|
||||
update();
|
||||
});
|
||||
}
|
||||
|
||||
void addCustomLadyIcon() {
|
||||
ImageConfiguration config = ImageConfiguration(
|
||||
size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
|
||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/lady1.png',
|
||||
mipmaps: false)
|
||||
.then((value) {
|
||||
ladyIcon = value;
|
||||
update();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -4,6 +4,22 @@ class MyTranslation extends Translations {
|
||||
@override
|
||||
Map<String, Map<String, String>> get keys => {
|
||||
"ar": {
|
||||
'message From Driver': 'رسالة من السائق',
|
||||
'message From passenger': "رسالة من الراكب",
|
||||
"Where are you, sir?": "أنا وصلت حضرتك فين.",
|
||||
"I've been trying to reach you but your phone is off.":
|
||||
"بحاول أكلمك التلفون مغلق.",
|
||||
"Please don't be late": "أرجو عدم التأخير",
|
||||
"Please don't be late, I'm waiting for you at the specified location.":
|
||||
"أرجو عدم التأخير، أنا منتظرك على ال لوكيشن المحدد.",
|
||||
"My location is correct. You can search for me using the navigation app":
|
||||
"موقعي صحيح. يمكنك البحث عني باستخدام تطبيق الملاحة",
|
||||
"Hello, I'm at the agreed-upon location":
|
||||
"مرحباً، أنا في المكان المتفق عليه",
|
||||
"message From Driver": "رسالة من السائق",
|
||||
|
||||
"How much longer will you be?": "قدامك قد إيه",
|
||||
'Phone number is verified before': "تم التحقق من رقم الهاتف مسبقاً",
|
||||
'Change Ride': 'تغيير الرحلة',
|
||||
'You can change the destination by long-pressing any point on the map':
|
||||
'يمكنك تغيير الوجهة بالضغط مطولاً على أي نقطة على الخريطة',
|
||||
@@ -423,7 +439,7 @@ iOS [https://getapp.cc/app/6458734951]
|
||||
"تَلْتَزِم سَفَر بِالسَّلَامَة، وَيَتِمُّ فَحْص جَمِيع قَبَاطِنِنَا بِعِنَايَة وَفَحْص خَلْفِيَّتِهِم.",
|
||||
"Driver Applied the Ride for You": "طَلَبَ السَّائِق الرِّحْلَة لَك",
|
||||
"Show latest promo": "أَظْهِر آخِر عَرْض تَرْوِيجِي",
|
||||
"Cancel Trip": "إِلْغَاء الرِّحْلَة",
|
||||
"Cancel Trip": "إلغاء الرحلة",
|
||||
"Passenger Cancel Trip": "الرَّاكِب أَلْغَى الرِّحْلَة",
|
||||
"Please stay on the picked point.":
|
||||
"الرَّجَاء الْبَقَاء فِي النُّقْطَة الْمُحَدَّدَة.",
|
||||
|
||||
@@ -69,6 +69,7 @@ class ProfileController extends GetxController {
|
||||
MyElevatedButton(
|
||||
title: 'Update'.tr,
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
await updateColumn({
|
||||
'id': box.read(BoxName.passengerID),
|
||||
columnName: txtController.text,
|
||||
@@ -76,7 +77,7 @@ class ProfileController extends GetxController {
|
||||
if (columnName == 'first_name') {
|
||||
box.write(BoxName.name, txtController.text);
|
||||
}
|
||||
Get.back();
|
||||
|
||||
txtController.clear();
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user