25-8-4-1
This commit is contained in:
@@ -69,10 +69,8 @@ class LoginDriverController extends GetxController {
|
||||
@override
|
||||
void onInit() async {
|
||||
box.write(BoxName.countryCode, 'Syria');
|
||||
box.read(BoxName.isTest) == null ||
|
||||
box.read(BoxName.isTest).toString() == '0'
|
||||
? await getAppTester()
|
||||
: null;
|
||||
// box.write(BoxName.driverID, '34feffd3fa72d6bee56b');
|
||||
await getAppTester();
|
||||
|
||||
super.onInit();
|
||||
}
|
||||
@@ -83,10 +81,15 @@ class LoginDriverController extends GetxController {
|
||||
payload: {'appPlatform': AppInformation.appName});
|
||||
if (res != 'failure') {
|
||||
var d = jsonDecode(res);
|
||||
|
||||
isTest = d['message'][0]['isTest'];
|
||||
box.write(BoxName.isTest, isTest);
|
||||
|
||||
Log.print('isTest: ${box.read(BoxName.isTest)}');
|
||||
update();
|
||||
} else {
|
||||
isTest = 0;
|
||||
box.write(BoxName.isTest, isTest);
|
||||
update();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ class OtpVerificationController extends GetxController {
|
||||
try {
|
||||
final response = await CRUD().post(
|
||||
link:
|
||||
'${AppLink.server}/auth/token_passenger/driver/verify_otp_driver/.php',
|
||||
'${AppLink.server}/auth/token_passenger/driver/verify_otp_driver.php',
|
||||
payload: {
|
||||
'phone_number': phone,
|
||||
'otp': otpCode.value,
|
||||
|
||||
@@ -2,10 +2,10 @@ import 'package:encrypt/encrypt.dart' as encrypt;
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:secure_string_operations/secure_string_operations.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/char_map.dart';
|
||||
import '../../env/env.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
|
||||
class EncryptionHelper {
|
||||
static EncryptionHelper? _instance;
|
||||
@@ -29,16 +29,14 @@ class EncryptionHelper {
|
||||
return; // Prevent re-initialization
|
||||
}
|
||||
debugPrint("Initializing EncryptionHelper...");
|
||||
// Read stored keys
|
||||
var keyOfApp = r(Env.keyOfApp).toString().split(Env.addd)[0];
|
||||
var initializationVector =
|
||||
r(Env.initializationVector).toString().split(Env.addd)[0];
|
||||
|
||||
// Log.print('initializationVector: ${initializationVector}');
|
||||
// Set the global instance
|
||||
_instance = EncryptionHelper._(
|
||||
encrypt.Key.fromUtf8(keyOfApp),
|
||||
encrypt.IV.fromUtf8(initializationVector),
|
||||
encrypt.Key.fromUtf8(keyOfApp!),
|
||||
encrypt.IV.fromUtf8(initializationVector!),
|
||||
);
|
||||
debugPrint("EncryptionHelper initialized successfully.");
|
||||
}
|
||||
@@ -46,8 +44,8 @@ class EncryptionHelper {
|
||||
/// Encrypts a string
|
||||
String encryptData(String plainText) {
|
||||
try {
|
||||
final encrypter = encrypt.Encrypter(
|
||||
encrypt.AES(key, mode: encrypt.AESMode.cbc)); // AES-GCM
|
||||
final encrypter =
|
||||
encrypt.Encrypter(encrypt.AES(key, mode: encrypt.AESMode.cbc));
|
||||
final encrypted = encrypter.encrypt(plainText, iv: iv);
|
||||
return encrypted.base64;
|
||||
} catch (e) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:location/location.dart';
|
||||
import 'package:sefer_driver/constant/table_names.dart';
|
||||
import 'package:sefer_driver/controller/home/captin/map_driver_controller.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/links.dart';
|
||||
@@ -87,7 +88,7 @@ class LocationController extends GetxController {
|
||||
Get.find<CaptainWalletController>().totalPoints.toString();
|
||||
isActive = Get.find<HomeCaptainController>().isActive;
|
||||
|
||||
if (isActive && double.parse(totalPoints) > -300) {
|
||||
if (isActive && double.parse(totalPoints) > -30000) {
|
||||
await getLocation();
|
||||
if (myLocation.latitude == 0 && myLocation.longitude == 0) return;
|
||||
|
||||
@@ -147,13 +148,25 @@ class LocationController extends GetxController {
|
||||
Get.find<HomeCaptainController>()
|
||||
.mapHomeCaptainController
|
||||
?.animateCamera(
|
||||
CameraUpdate.newLatLng(
|
||||
LatLng(
|
||||
myLocation.latitude,
|
||||
myLocation.longitude,
|
||||
CameraUpdate.newCameraPosition(
|
||||
CameraPosition(
|
||||
bearing: Get.find<LocationController>().heading,
|
||||
target: myLocation,
|
||||
zoom: 17, // Adjust zoom level as needed
|
||||
),
|
||||
),
|
||||
);
|
||||
// if (Get.isRegistered()) {
|
||||
// Get.find<MapDriverController>().mapController?.animateCamera(
|
||||
// CameraUpdate.newCameraPosition(
|
||||
// CameraPosition(
|
||||
// bearing: Get.find<LocationController>().heading,
|
||||
// target: myLocation,
|
||||
// zoom: 17, // Adjust zoom level as needed
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
}
|
||||
} catch (e) {
|
||||
print('Location update error: $e');
|
||||
|
||||
@@ -15,13 +15,15 @@ import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../../constant/info.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
import 'encrypt_decrypt.dart';
|
||||
|
||||
Future<void> checkForUpdate(BuildContext context) async {
|
||||
final packageInfo = await PackageInfo.fromPlatform();
|
||||
final currentVersion = packageInfo.buildNumber;
|
||||
final version = packageInfo.version;
|
||||
// print('currentVersion is : $currentVersion');
|
||||
Log.print('version: ${version}');
|
||||
print('currentVersion is : $currentVersion');
|
||||
// Fetch the latest version from your server
|
||||
String latestVersion = await getPackageInfo();
|
||||
box.write(BoxName.packagInfo, version);
|
||||
@@ -45,8 +47,8 @@ Future<String> getPackageInfo() async {
|
||||
|
||||
void showUpdateDialog(BuildContext context) {
|
||||
final String storeUrl = Platform.isAndroid
|
||||
? 'https://play.google.com/store/apps/details?id=com.sefer_driver'
|
||||
: 'https://apps.apple.com/ae/app/sefer-driver/id6502189302';
|
||||
? 'https://play.google.com/store/apps/details?id=com.intaleq_driver'
|
||||
: 'https://apps.apple.com/ae/app/intaleq-driver/id6502189302';
|
||||
|
||||
showGeneralDialog(
|
||||
context: context,
|
||||
|
||||
@@ -14,6 +14,7 @@ import 'package:path_provider/path_provider.dart' as path_provider;
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/info.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
import 'encrypt_decrypt.dart';
|
||||
@@ -310,17 +311,20 @@ class ImageController extends GetxController {
|
||||
Log.print('request: ${request}');
|
||||
var length = await file.length();
|
||||
var stream = http.ByteStream(file.openRead());
|
||||
final headers = {
|
||||
'Authorization':
|
||||
'Bearer ${r(box.read(BoxName.jwt)).split(AppInformation.addd)[0]}',
|
||||
'X-HMAC-Auth': '${box.read(BoxName.hmac)}',
|
||||
};
|
||||
var multipartFile = http.MultipartFile(
|
||||
'image',
|
||||
stream,
|
||||
length,
|
||||
filename: basename(file.path),
|
||||
);
|
||||
request.headers.addAll({
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}',
|
||||
});
|
||||
request.headers.addAll(headers);
|
||||
// Set the file name to the driverID
|
||||
|
||||
request.files.add(
|
||||
http.MultipartFile(
|
||||
'image',
|
||||
@@ -418,14 +422,11 @@ class ImageController extends GetxController {
|
||||
try {
|
||||
await uploadImage(
|
||||
compressedImage,
|
||||
{
|
||||
'driverID':
|
||||
(box.read(BoxName.driverID)) ?? (box.read(BoxName.passengerID)),
|
||||
'imageType': imageType
|
||||
},
|
||||
{'driverID': (box.read(BoxName.driverID)), 'imageType': imageType},
|
||||
link,
|
||||
);
|
||||
} catch (e) {
|
||||
Log.print('e: ${e}');
|
||||
mySnackeBarError('Image Upload Failed'.tr);
|
||||
// Get.snackbar('Image Upload Failed'.tr, e.toString(),
|
||||
// backgroundColor: AppColor.redColor);
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:sefer_driver/controller/functions/crud.dart';
|
||||
|
||||
import '../../../constant/table_names.dart';
|
||||
import '../../../main.dart';
|
||||
import '../../../print.dart';
|
||||
|
||||
class DriverBehaviorController extends GetxController {
|
||||
Future<List<Map<String, dynamic>>> getAllData() async {
|
||||
@@ -27,16 +28,17 @@ class DriverBehaviorController extends GetxController {
|
||||
);
|
||||
|
||||
if (response != 'failure') {
|
||||
final json = jsonDecode(response.body);
|
||||
final json = jsonDecode(response);
|
||||
|
||||
overallScore.value =
|
||||
double.parse(json['data']['overall_behavior_score'].toString());
|
||||
lastTrips.value = json['data']['last_10_trips'];
|
||||
double.parse(json['message']['overall_behavior_score'].toString());
|
||||
lastTrips.value = json['message']['last_10_trips'];
|
||||
} else {
|
||||
// Get.snackbar("Error", json['message'] ?? "Unknown error");
|
||||
}
|
||||
} catch (e) {
|
||||
Get.snackbar("Error", "Exception: $e");
|
||||
// Get.snackbar("Error", "Exception: $e");
|
||||
Log.print('e: ${e}');
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
@@ -281,6 +281,7 @@ class HomeCaptainController extends GetxController {
|
||||
onMapCreated(mapHomeCaptainController!);
|
||||
// totalPoints = Get.find<CaptainWalletController>().totalPoints.toString();
|
||||
getRefusedOrderByCaptain();
|
||||
box.write(BoxName.statusDriverLocation, 'off');
|
||||
// LocationController().getLocation();
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
import 'package:sefer_driver/controller/home/captin/behavior_controller.dart';
|
||||
import 'package:sefer_driver/controller/home/captin/home_captain_controller.dart';
|
||||
import 'package:sefer_driver/views/widgets/mydialoug.dart';
|
||||
@@ -107,11 +108,16 @@ class MapDriverController extends GetxController {
|
||||
LatLng latLngPassengerLocation = LatLng(0, 0);
|
||||
late LatLng latLngPassengerDestination = LatLng(0, 0);
|
||||
|
||||
List<Map<String, dynamic>> routeSteps = [];
|
||||
String currentInstruction = "";
|
||||
int currentStepIndex = 0;
|
||||
|
||||
void onMapCreated(GoogleMapController controller) async {
|
||||
myLocation = Get.find<LocationController>().myLocation;
|
||||
// myLocation = myLocation;
|
||||
mapController = controller;
|
||||
controller.getVisibleRegion();
|
||||
// LatLngBounds bounds = await controller.getVisibleRegion();
|
||||
controller.animateCamera(
|
||||
CameraUpdate.newLatLng(Get.find<LocationController>().myLocation),
|
||||
);
|
||||
@@ -410,20 +416,20 @@ class MapDriverController extends GetxController {
|
||||
'order_id': (rideId).toString(),
|
||||
'status': 'Begin'
|
||||
});
|
||||
if (AppLink.endPoint != AppLink.seferCairoServer) {
|
||||
CRUD().post(link: "${AppLink.endPoint}/rides/update.php", payload: {
|
||||
'id': (rideId),
|
||||
'rideTimeStart': DateTime.now().toString(),
|
||||
'status': 'Begin',
|
||||
});
|
||||
CRUD().post(
|
||||
link: '${AppLink.endPoint}/rides/driver_order/add.php',
|
||||
payload: {
|
||||
'driver_id': box.read(BoxName.driverID).toString(),
|
||||
'order_id': (rideId).toString(),
|
||||
'status': 'Begin'
|
||||
});
|
||||
}
|
||||
// if (AppLink.endPoint != AppLink.seferCairoServer) {
|
||||
// CRUD().post(link: "${AppLink.endPoint}/rides/update.php", payload: {
|
||||
// 'id': (rideId),
|
||||
// 'rideTimeStart': DateTime.now().toString(),
|
||||
// 'status': 'Begin',
|
||||
// });
|
||||
// CRUD().post(
|
||||
// link: '${AppLink.endPoint}/rides/driver_order/add.php',
|
||||
// payload: {
|
||||
// 'driver_id': box.read(BoxName.driverID).toString(),
|
||||
// 'order_id': (rideId).toString(),
|
||||
// 'status': 'Begin'
|
||||
// });
|
||||
// }
|
||||
Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
|
||||
'Trip is Begin'.tr,
|
||||
box.read(BoxName.nameDriver).toString(),
|
||||
@@ -591,28 +597,34 @@ class MapDriverController extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> finishRideFromDriver() async {
|
||||
double distanceToDestination = Geolocator.distanceBetween(
|
||||
latLngPassengerDestination.latitude,
|
||||
latLngPassengerDestination.longitude,
|
||||
Get.find<LocationController>().myLocation.latitude,
|
||||
Get.find<LocationController>().myLocation.longitude,
|
||||
);
|
||||
// double distanceToDestination = Geolocator.distanceBetween(
|
||||
// latLngPassengerDestination.latitude,
|
||||
// latLngPassengerDestination.longitude,
|
||||
// Get.find<LocationController>().myLocation.latitude,
|
||||
// Get.find<LocationController>().myLocation.longitude,
|
||||
// );
|
||||
final originalDistanceM = double.parse(distance.toString()) * 1000;
|
||||
|
||||
// 2. احسب المسافة التي قطعها السائق حتى الآن
|
||||
final movedDistanceM = originalDistanceM - distanceToDestination;
|
||||
final movedDistanceM = Geolocator.distanceBetween(
|
||||
Get.find<LocationController>().myLocation.latitude,
|
||||
Get.find<LocationController>().myLocation.longitude,
|
||||
latLngPassengerDestination.latitude,
|
||||
latLngPassengerDestination.longitude,
|
||||
);
|
||||
// originalDistanceM - distanceToDestination;
|
||||
|
||||
// 3. عتبة ثلث المسافة
|
||||
final oneThirdDistanceM = originalDistanceM / 3;
|
||||
|
||||
// Logging للتتبع
|
||||
Log.print('originalDistanceM: $originalDistanceM');
|
||||
Log.print('distanceToDestinationM: $distanceToDestination');
|
||||
// Log.print('distanceToDestinationM: $distanceToDestination');
|
||||
Log.print('movedDistanceM: $movedDistanceM');
|
||||
Log.print('oneThirdDistanceM: $oneThirdDistanceM');
|
||||
|
||||
// 4. إذا لم يقطع السائق ثلث المسافة، نعرض التأكيد
|
||||
if (movedDistanceM < oneThirdDistanceM) {
|
||||
if (movedDistanceM > oneThirdDistanceM * 2) {
|
||||
MyDialog().getDialog(
|
||||
'Are you sure to exit ride?'.tr,
|
||||
'',
|
||||
@@ -1177,6 +1189,7 @@ class MapDriverController extends GetxController {
|
||||
('${AppLink.googleMapsLink}directions/json?&language=${box.read(BoxName.lang)}&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AK.mapAPIKEY}');
|
||||
|
||||
var response = await CRUD().getGoogleApi(link: url, payload: {});
|
||||
Log.print('response: ${response}');
|
||||
data = response['routes'][0]['legs'];
|
||||
distanceBetweenDriverAndPassengerWhenConfirm =
|
||||
(data[0]['distance']['value']) / 1000;
|
||||
@@ -1230,6 +1243,84 @@ class MapDriverController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
void checkForNextStep(LatLng currentPosition) {
|
||||
if (currentStepIndex >= routeSteps.length) return;
|
||||
|
||||
final step = routeSteps[currentStepIndex];
|
||||
final endLocation = step['end_location'];
|
||||
final endLatLng = LatLng(endLocation['lat'], endLocation['lng']);
|
||||
|
||||
final distance = calculateDistance(
|
||||
currentPosition.latitude,
|
||||
currentPosition.longitude,
|
||||
endLatLng.latitude,
|
||||
endLatLng.longitude,
|
||||
);
|
||||
|
||||
if (distance < 50) {
|
||||
// 50 متر قبل النقطة
|
||||
currentStepIndex++;
|
||||
if (currentStepIndex < routeSteps.length) {
|
||||
currentInstruction = _parseInstruction(
|
||||
routeSteps[currentStepIndex]['html_instructions']);
|
||||
Get.isRegistered<TextToSpeechController>()
|
||||
? Get.find<TextToSpeechController>().speakText(currentInstruction)
|
||||
: Get.put(TextToSpeechController()).speakText(currentInstruction);
|
||||
Log.print('Current Instruction: $currentInstruction');
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Calculates the distance in meters between two latitude/longitude points.
|
||||
double calculateDistance(double lat1, double lon1, double lat2, double lon2) {
|
||||
const double earthRadius = 6371000; // meters
|
||||
double dLat = _degreesToRadians(lat2 - lat1);
|
||||
double dLon = _degreesToRadians(lon2 - lon1);
|
||||
|
||||
double a = (sin(dLat / 2) * sin(dLat / 2)) +
|
||||
cos(_degreesToRadians(lat1)) *
|
||||
cos(_degreesToRadians(lat2)) *
|
||||
(sin(dLon / 2) * sin(dLon / 2));
|
||||
double c = 2 * atan2(sqrt(a), sqrt(1 - a));
|
||||
double distance = earthRadius * c;
|
||||
return distance;
|
||||
}
|
||||
|
||||
double _degreesToRadians(double degrees) {
|
||||
return degrees * (3.1415926535897932 / 180.0);
|
||||
}
|
||||
|
||||
String _parseInstruction(String htmlInstruction) {
|
||||
return htmlInstruction.replaceAll(RegExp(r'<[^>]*>'), '');
|
||||
}
|
||||
|
||||
void checkDestinationProximity() {
|
||||
final distance = calculateDistance(
|
||||
myLocation.latitude,
|
||||
myLocation.longitude,
|
||||
latLngPassengerDestination.latitude,
|
||||
latLngPassengerDestination.longitude,
|
||||
);
|
||||
|
||||
if (distance < 300) {
|
||||
// 300 متر قبل الوجهة
|
||||
Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
|
||||
"You are near the destination".tr,
|
||||
"You are near the destination".tr,
|
||||
tokenPassenger,
|
||||
[
|
||||
box.read(BoxName.driverID),
|
||||
rideId,
|
||||
box.read(BoxName.tokenDriver),
|
||||
paymentAmount.toString()
|
||||
],
|
||||
'ding.wav',
|
||||
);
|
||||
// يمكن إضافة أي إجراء آخر هنا عند الاقتراب من الوجهة
|
||||
}
|
||||
}
|
||||
|
||||
getMapDestination(String origin, destination) async {
|
||||
var url =
|
||||
('${AppLink.googleMapsLink}directions/json?&language=${box.read(BoxName.lang)}&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AK.mapAPIKEY}');
|
||||
@@ -1243,6 +1334,22 @@ class MapDriverController extends GetxController {
|
||||
double lng = points[i][1].toDouble();
|
||||
polylineCoordinatesDestination.add(LatLng(lat, lng));
|
||||
}
|
||||
// استخراج الخطوات
|
||||
routeSteps = List<Map<String, dynamic>>.from(dataDestination[0]['steps']);
|
||||
Log.print('routeSteps: ${routeSteps}');
|
||||
currentStepIndex = 0;
|
||||
if (routeSteps.isNotEmpty) {
|
||||
currentInstruction =
|
||||
_parseInstruction(routeSteps[0]['html_instructions']);
|
||||
Log.print('currentInstruction: ${currentInstruction}');
|
||||
Get.isRegistered<TextToSpeechController>()
|
||||
? Get.find<TextToSpeechController>().speakText(currentInstruction)
|
||||
: Get.put(TextToSpeechController()).speakText(currentInstruction);
|
||||
}
|
||||
update();
|
||||
|
||||
// دالة مساعدة لتنظيف التعليمات
|
||||
|
||||
if (polyLinesDestination.isNotEmpty) {
|
||||
// clearPolyline();
|
||||
var polyline = Polyline(
|
||||
@@ -1404,6 +1511,7 @@ class MapDriverController extends GetxController {
|
||||
hours = durationToAdd.inHours;
|
||||
minutes = (durationToAdd.inMinutes % 60).round();
|
||||
calculateConsumptionFuel();
|
||||
updateLocation();
|
||||
// cancelCheckRidefromPassenger();
|
||||
// checkIsDriverNearPassenger();
|
||||
super.onInit();
|
||||
|
||||
86
lib/controller/home/captin/model.dart
Normal file
86
lib/controller/home/captin/model.dart
Normal file
@@ -0,0 +1,86 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
|
||||
class NavigationStep {
|
||||
final String instruction;
|
||||
final String maneuver;
|
||||
final double distance;
|
||||
final String duration;
|
||||
final LatLng startLocation;
|
||||
final LatLng endLocation;
|
||||
final String htmlInstructions;
|
||||
|
||||
NavigationStep({
|
||||
required this.instruction,
|
||||
required this.maneuver,
|
||||
required this.distance,
|
||||
required this.duration,
|
||||
required this.startLocation,
|
||||
required this.endLocation,
|
||||
required this.htmlInstructions,
|
||||
});
|
||||
|
||||
factory NavigationStep.fromJson(Map<String, dynamic> json) {
|
||||
return NavigationStep(
|
||||
instruction: json['html_instructions'] ?? '',
|
||||
maneuver: json['maneuver'] ?? 'straight',
|
||||
distance: (json['distance']['value'] ?? 0).toDouble(),
|
||||
duration: json['duration']['text'] ?? '',
|
||||
startLocation: LatLng(
|
||||
json['start_location']['lat'].toDouble(),
|
||||
json['start_location']['lng'].toDouble(),
|
||||
),
|
||||
endLocation: LatLng(
|
||||
json['end_location']['lat'].toDouble(),
|
||||
json['end_location']['lng'].toDouble(),
|
||||
),
|
||||
htmlInstructions: json['html_instructions'] ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
// Get clean instruction text (remove HTML tags)
|
||||
String get cleanInstruction {
|
||||
return instruction
|
||||
.replaceAll(RegExp(r'<[^>]*>'), '')
|
||||
.replaceAll(' ', ' ');
|
||||
}
|
||||
|
||||
// Get instruction icon based on maneuver
|
||||
IconData get instructionIcon {
|
||||
switch (maneuver.toLowerCase()) {
|
||||
case 'turn-left':
|
||||
return Icons.turn_left;
|
||||
case 'turn-right':
|
||||
return Icons.turn_right;
|
||||
case 'turn-slight-left':
|
||||
return Icons.turn_slight_left;
|
||||
case 'turn-slight-right':
|
||||
return Icons.turn_slight_right;
|
||||
case 'turn-sharp-left':
|
||||
return Icons.turn_sharp_left;
|
||||
case 'turn-sharp-right':
|
||||
return Icons.turn_sharp_right;
|
||||
case 'uturn-left':
|
||||
case 'uturn-right':
|
||||
return Icons.u_turn_left;
|
||||
case 'straight':
|
||||
return Icons.straight;
|
||||
case 'ramp-left':
|
||||
return Icons.ramp_left;
|
||||
case 'ramp-right':
|
||||
return Icons.ramp_right;
|
||||
case 'merge':
|
||||
return Icons.merge;
|
||||
case 'fork-left':
|
||||
case 'fork-right':
|
||||
return Icons.call_split;
|
||||
case 'ferry':
|
||||
return Icons.directions_boat;
|
||||
case 'roundabout-left':
|
||||
case 'roundabout-right':
|
||||
return Icons.roundabout_left;
|
||||
default:
|
||||
return Icons.navigation;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -335,7 +335,83 @@ Raih Gai: For same-day return trips longer than 50km.
|
||||
"ATTIJARIWAFA BANK Egypt": "البنك التجاري وفا مصر",
|
||||
"Morning Promo": "بونص الصباح",
|
||||
"Show my Cars": "عرض سياراتي",
|
||||
"Add criminal page": "إضافة الفيش الجنائي",
|
||||
'Behavior Score': "درجة السلوك",
|
||||
"Driver Behavior": "سلوك السائق",
|
||||
"Last 10 Trips": "آخر 10 رحلات",
|
||||
"Trip ID": "رقم الرحلة", 'Vehicle Details': "تفاصيل المركبة",
|
||||
'Hard Brake': "فرملة قوية",
|
||||
'Show behavior page': "عرض صفحة السلوك",
|
||||
'Coming Soon': "قريبًا",
|
||||
'Logout': "تسجيل الخروج",
|
||||
'Contact Support to Recharge': "تواصل مع الدعم لإعادة الشحن",
|
||||
'Are you sure you want to logout?':
|
||||
"هل أنت متأكد أنك تريد تسجيل الخروج؟",
|
||||
"How to use App": "كيفية استخدام التطبيق",
|
||||
'This service will be available soon.':
|
||||
"هذه الخدمة ستكون متاحة قريبًا.",
|
||||
'Change the app language': "تغيير لغة التطبيق",
|
||||
'Get features for your country': "احصل على ميزات لبلدك",
|
||||
'Vibration feedback for buttons': "ردود فعل الاهتزاز للأزرار",
|
||||
'Run Google Maps directly': "تشغيل خرائط جوجل مباشرة",
|
||||
'reviews': "المراجعات",
|
||||
"Trip Summary with": "ملخص الرحلة مع",
|
||||
"Original Fare": "الأجرة الأصلية",
|
||||
"Your Earnings": "أرباحك",
|
||||
"Exclusive offers and discounts always with the Sefer app":
|
||||
"عروض وخصومات حصرية دائماً مع تطبيق سفر",
|
||||
"Would the passenger like to settle the remaining fare using their wallet?":
|
||||
"هل يرغب الراكب بتسوية الأجرة المتبقية من محفظته؟",
|
||||
"Yes, Pay": "نعم، ادفع",
|
||||
"How much Passenger pay?": "كم دفع الراكب؟",
|
||||
"Passenger paid amount": "المبلغ الذي دفعه الراكب",
|
||||
"Add to Passenger Wallet": "أضف إلى محفظة الراكب",
|
||||
"How was the passenger?": "كيف كان الراكب؟",
|
||||
"Add a comment (optional)": "أضف تعليقاً (اختياري)",
|
||||
"Type something...": "اكتب شيئاً...",
|
||||
"Submit rating": "إرسال التقييم",
|
||||
'Trip Summary with': "ملخص الرحلة مع",
|
||||
'Original Fare': "الأجرة الأصلية",
|
||||
'Your Earnings': "أرباحك",
|
||||
'Exclusive offers and discounts always with the Intaleq app':
|
||||
"عروض وخصومات حصرية دائماً مع تطبيق انطلق",
|
||||
'Enter your email'
|
||||
'''Types of Trips in Intaleq:
|
||||
|
||||
- Comfort: For cars newer than 2017 with air conditioning.
|
||||
- Lady: For girl drivers.
|
||||
- Speed: For fixed salary and endpoints.
|
||||
- Mashwari: For flexible trips where passengers choose the car and driver with prior arrangements.
|
||||
- Raih Gai: For same-day return trips longer than 50km.''':
|
||||
'''أنواع الرحلات في Intaleq:
|
||||
- راحة: للسيارات الأحدث من 2017 مع تكييف الهواء.
|
||||
- للسائقات الإناث.
|
||||
- سبيد: براتب ثابت ونقاط نهاية محددة.
|
||||
- مشاوير: للرحلات المرنة حيث يختار الركاب السيارة والسائق باتفاق مسبق.
|
||||
- رحّي غاي: للرحلات ذات العودة في نفس اليوم التي تزيد عن 50 كم.''',
|
||||
|
||||
'''Intaleq Wallet Features:
|
||||
|
||||
- Transfer money multiple times.
|
||||
- Transfer to anyone.
|
||||
- Make purchases.
|
||||
- Charge your account.
|
||||
- Charge a friend's Intaleq account.
|
||||
- Store your money with us and receive it in your bank as a monthly salary.''':
|
||||
'''ميزات محفظة Intaleq:
|
||||
- تحويل الأموال عدة مرات.
|
||||
- التحويل إلى أي شخص.
|
||||
- إجراء عمليات شراء.
|
||||
- شحن حسابك.
|
||||
- شحن حساب Intaleq لصديق.
|
||||
- قم بتخزين أموالك معنا واستلامها في بنكك كراتب شهري.''',
|
||||
'Are you sure you want to logout?':
|
||||
"هل أنت متأكد أنك تريد تسجيل الخروج؟",
|
||||
'My Cars': "سياراتي",
|
||||
'Bank Account': "الحساب البنكي",
|
||||
'Behavior Page': "صفحة السلوك",
|
||||
'Personal Information': "المعلومات الشخصية",
|
||||
"Add criminal page": "إضافة صفحة جنائية",
|
||||
"Overall Behavior Score": "درجة السلوك العامة",
|
||||
"Add new car": "إضافة سيارة جديدة",
|
||||
"You have gift 300 L.E": "لديك هدية بقيمة 300 جنيه.",
|
||||
// "VIP Order": "طلب VIP",
|
||||
|
||||
@@ -7,6 +7,8 @@ import 'package:sefer_driver/constant/links.dart';
|
||||
import 'package:sefer_driver/controller/functions/crud.dart';
|
||||
import 'package:sefer_driver/main.dart';
|
||||
|
||||
import '../../views/widgets/error_snakbar.dart';
|
||||
|
||||
class CaptainProfileController extends GetxController {
|
||||
bool isLoading = false;
|
||||
TextEditingController vin = TextEditingController();
|
||||
@@ -15,6 +17,25 @@ class CaptainProfileController extends GetxController {
|
||||
TextEditingController model = TextEditingController();
|
||||
TextEditingController year = TextEditingController();
|
||||
TextEditingController expirationDate = TextEditingController();
|
||||
final TextEditingController emailController = TextEditingController();
|
||||
|
||||
updateEmail() async {
|
||||
var payload = {
|
||||
'id': box.read(BoxName.driverID).toString(),
|
||||
'email': emailController.text,
|
||||
};
|
||||
|
||||
var res =
|
||||
await CRUD().post(link: AppLink.updateDriverEmail, payload: payload);
|
||||
|
||||
if ((res)['status'] == 'success') {
|
||||
box.write(BoxName.email, emailController.text);
|
||||
update();
|
||||
Get.back();
|
||||
} else {
|
||||
mySnackeBarError((res)['message']);
|
||||
}
|
||||
}
|
||||
|
||||
Future updateFields() async {
|
||||
var payload = {
|
||||
|
||||
Reference in New Issue
Block a user