This commit is contained in:
Hamza-Ayed
2024-01-18 00:49:00 +03:00
parent 358bb904ab
commit 7af7e71b30
17 changed files with 1028 additions and 269 deletions

View File

@@ -2,7 +2,7 @@ import UIKit
import Flutter import Flutter
import FirebaseCore import FirebaseCore
import GoogleMaps import GoogleMaps
import Constants // import Constants
@UIApplicationMain @UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate { @objc class AppDelegate: FlutterAppDelegate {
@@ -11,7 +11,7 @@ import Constants
_ application: UIApplication, _ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool { ) -> Bool {
GMSServices.provideAPIKey(mapsApiKey) GMSServices.provideAPIKey("AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0")
FirebaseApp.configure() FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self) GeneratedPluginRegistrant.register(with: self)
return true return true

View File

@@ -12,10 +12,14 @@ import '../../constant/colors.dart';
class ContentController extends GetxController { class ContentController extends GetxController {
final picker = ImagePicker(); final picker = ImagePicker();
Map<String, dynamic> responseMap = {};
Map<String, dynamic> responseCarLicenseMap = {};
Map<String, dynamic> responseBackCarLicenseMap = {};
Map<String, dynamic> responseIdCardeMap = {};
bool isloading = false; bool isloading = false;
var image; var image;
CroppedFile? croppedFile; CroppedFile? croppedFile;
DateTime now = DateTime.now();
Future<void> pickImage() async { Future<void> pickImage() async {
final pickedImage = await picker.pickImage(source: ImageSource.gallery); final pickedImage = await picker.pickImage(source: ImageSource.gallery);
@@ -153,6 +157,294 @@ class ContentController extends GetxController {
} }
} }
Future<void> generateDriverLicenseJordanContent() async {
await pickImage();
isloading = true;
update();
if (image != null) {
final imageBytes = await image.readAsBytes();
final imageData = base64Encode(imageBytes);
var requestBody = jsonEncode({
'contents': [
{
'parts': [
{
'inlineData': {
'mimeType': 'image/jpeg',
'data': imageData,
},
},
{
'text':
'write json for all data as first name ,last name,dob,id ,expiration date,issued date asdress class type,age in years ,output json type in arabic value and stay engish key and make date format like YYYY-MM-DD , for name please extract name in arabic in Name in json plus first_name ',
},
],
},
],
'generationConfig': {
'temperature': 0.4,
'topK': 32,
'topP': 1,
'maxOutputTokens': 4096,
'stopSequences': [],
},
'safetySettings': [
{
'category': 'HARM_CATEGORY_HARASSMENT',
'threshold': 'BLOCK_MEDIUM_AND_ABOVE',
},
{
'category': 'HARM_CATEGORY_HATE_SPEECH',
'threshold': 'BLOCK_MEDIUM_AND_ABOVE',
},
{
'category': 'HARM_CATEGORY_SEXUALLY_EXPLICIT',
'threshold': 'BLOCK_MEDIUM_AND_ABOVE',
},
{
'category': 'HARM_CATEGORY_DANGEROUS_CONTENT',
'threshold': 'BLOCK_MEDIUM_AND_ABOVE',
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro-vision:generateContent?key=${AK.geminiApi}'),
headers: {'Content-Type': 'application/json'},
body: requestBody,
);
isloading = false;
update();
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
if (jsonString != null) {
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
responseMap = jsonDecode(jsonString);
print(jsonString);
print(responseMap);
print(responseMap['dob']);
} else {
print("JSON string not found");
}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
}
Future<void> generateCarLicenseJordanContent() async {
await pickImage();
isloading = true;
update();
if (image != null) {
final imageBytes = await image.readAsBytes();
final imageData = base64Encode(imageBytes);
var requestBody = jsonEncode({
'contents': [
{
'parts': [
{
'inlineData': {
'mimeType': 'image/jpeg',
'data': imageData,
},
},
{
'text':
'write json output of this car license in jordan json contain name , address , car kind ,car color , car year , car plate ,registration adjective , using ,expire date of license and make date format like YYYY-MM-DD .dont add data else this image',
},
],
},
],
'generationConfig': {
'temperature': 0.4,
'topK': 32,
'topP': 1,
'maxOutputTokens': 4096,
'stopSequences': [],
},
'safetySettings': [
{
'category': 'HARM_CATEGORY_HARASSMENT',
'threshold': 'BLOCK_MEDIUM_AND_ABOVE',
},
{
'category': 'HARM_CATEGORY_HATE_SPEECH',
'threshold': 'BLOCK_MEDIUM_AND_ABOVE',
},
{
'category': 'HARM_CATEGORY_SEXUALLY_EXPLICIT',
'threshold': 'BLOCK_MEDIUM_AND_ABOVE',
},
{
'category': 'HARM_CATEGORY_DANGEROUS_CONTENT',
'threshold': 'BLOCK_MEDIUM_AND_ABOVE',
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro-vision:generateContent?key=${AK.geminiApi}'),
headers: {'Content-Type': 'application/json'},
body: requestBody,
);
isloading = false;
update();
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
if (jsonString != null) {
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
responseCarLicenseMap = jsonDecode(jsonString);
print(jsonString);
print(responseCarLicenseMap);
print(responseCarLicenseMap['plate_number']);
} else {
print("JSON string not found");
}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
}
Future<void> generateBackCarLicenseJordanContent() async {
await pickImage();
isloading = true;
update();
if (image != null) {
final imageBytes = await image.readAsBytes();
final imageData = base64Encode(imageBytes);
var requestBody = jsonEncode({
'contents': [
{
'parts': [
{
'inlineData': {
'mimeType': 'image/jpeg',
'data': imageData,
},
},
{
'text':
'write json output from extracting car license back face for these key ,vin,fuelType,passengerType,curbWeight,insuranceCompany,policyNumber,notes,insuranceType and output it json .dont add data else this image',
},
],
},
],
'generationConfig': {
'temperature': 0.4,
'topK': 343,
'topP': 1,
'maxOutputTokens': 4096,
'stopSequences': [],
},
'safetySettings': [
{
'category': 'HARM_CATEGORY_HARASSMENT',
'threshold': 'BLOCK_MEDIUM_AND_ABOVE',
},
{
'category': 'HARM_CATEGORY_HATE_SPEECH',
'threshold': 'BLOCK_MEDIUM_AND_ABOVE',
},
{
'category': 'HARM_CATEGORY_SEXUALLY_EXPLICIT',
'threshold': 'BLOCK_MEDIUM_AND_ABOVE',
},
{
'category': 'HARM_CATEGORY_DANGEROUS_CONTENT',
'threshold': 'BLOCK_MEDIUM_AND_ABOVE',
},
],
});
print(requestBody);
final response = await http.post(
Uri.parse(
'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro-vision:generateContent?key=${AK.geminiApi}'),
headers: {'Content-Type': 'application/json'},
body: requestBody,
);
isloading = false;
update();
if (response.statusCode == 200) {
var responseData = jsonDecode(response.body);
// Process the responseData as needed
// print(responseData);
var result =
responseData['candidates'][0]['content']['parts'][0]['text'];
// print(jsonEncode(result));
// print((result));
// print(result['dob']);
RegExp regex = RegExp(r"```json([^`]*)```");
String? jsonString =
regex.firstMatch(responseData.toString())?.group(1)?.trim();
if (jsonString != null) {
// Convert the JSON object to a String
jsonString = jsonEncode(json.decode(jsonString));
responseBackCarLicenseMap = jsonDecode(jsonString);
// print(jsonString);
print(responseBackCarLicenseMap);
// print(responseCarLicenseMap['plate_number']);
} else {
print("JSON string not found");
}
// Rest of your code...
} else {
print('Request failed with status: ${response.statusCode}');
print('Request failed with status: ${response.body}');
}
} else {
print('No image selected');
}
}
Future<void> getFromCarRegistration() async { Future<void> getFromCarRegistration() async {
await pickImage(); await pickImage();
if (image != null) { if (image != null) {

View File

@@ -24,6 +24,7 @@ class LocationController extends GetxController {
void onInit() async { void onInit() async {
super.onInit(); super.onInit();
location = Location(); location = Location();
totalPoints = Get.find<CaptainWalletController>().totalPoints; totalPoints = Get.find<CaptainWalletController>().totalPoints;
getLocation(); getLocation();
} }

View File

@@ -185,6 +185,7 @@ class HomeCaptainController extends GetxController {
getPaymentToday(); getPaymentToday();
getAllPayment(); getAllPayment();
startPeriodicExecution(); startPeriodicExecution();
onMapCreated(mapHomeCaptaiController!);
getRefusedOrderByCaptain(); getRefusedOrderByCaptain();
totalPoints = Get.find<CaptainWalletController>().totalPoints; totalPoints = Get.find<CaptainWalletController>().totalPoints;
super.onInit(); super.onInit();

View File

@@ -31,11 +31,17 @@ class MapDriverController extends GetxController {
Set<Marker> markers = {}; Set<Marker> markers = {};
late String passengerLocation; late String passengerLocation;
late String passengerDestination; late String passengerDestination;
late String step0;
late String step1;
late String step2;
late String step3;
late String step4;
late String duration; late String duration;
late String distance; late String distance;
late String name; late String name;
late String phone; late String phone;
late String rideId; late String rideId;
late String isHaveSteps;
late String paymentAmount; late String paymentAmount;
late String paymentMethod; late String paymentMethod;
late String passengerId; late String passengerId;
@@ -311,20 +317,15 @@ class MapDriverController extends GetxController {
), ),
); );
// Update the `markers` set and call the `update()` method on the controller to notify the view that the marker position has changed.
update();
// No recursive call here. The marker update will be triggered externally.
// Optionally, you can animate the camera to the new location after updating the marker.
mapController!.animateCamera( mapController!.animateCamera(
CameraUpdate.newLatLng(locationController.myLocation), CameraUpdate.newLatLng(locationController.myLocation),
); );
update();
} }
void addCustomCarIcon() { void addCustomCarIcon() {
ImageConfiguration config = ImageConfiguration( ImageConfiguration config = const ImageConfiguration(
size: Size(Get.width * .6, Get.height * .6), size: Size(20, 20),
// scale: 1.0, // scale: 1.0,
); );
BitmapDescriptor.fromAssetImage(config, 'assets/images/car.png') BitmapDescriptor.fromAssetImage(config, 'assets/images/car.png')
@@ -441,13 +442,25 @@ class MapDriverController extends GetxController {
rideId = Get.arguments['rideId']; rideId = Get.arguments['rideId'];
durationOfRideValue = Get.arguments['durationOfRideValue']; durationOfRideValue = Get.arguments['durationOfRideValue'];
paymentAmount = Get.arguments['paymentAmount']; paymentAmount = Get.arguments['paymentAmount'];
paymentMethod = Get.arguments['paymentMethod']; isHaveSteps = Get.arguments['isHaveSteps'];
step0 = Get.arguments['step0'];
step1 = Get.arguments['step1'];
step2 = Get.arguments['step2'];
step3 = Get.arguments['step3'];
step4 = Get.arguments['step4'];
String lat = Get.find<LocationController>().myLocation.latitude.toString(); String lat = Get.find<LocationController>().myLocation.latitude.toString();
String lng = Get.find<LocationController>().myLocation.longitude.toString(); String lng = Get.find<LocationController>().myLocation.longitude.toString();
String origin = '$lat,$lng'; String origin = '$lat,$lng';
// Set the origin and destination coordinates for the Google Maps directions request. // Set the origin and destination coordinates for the Google Maps directions request.
getMap(origin, passengerLocation); getMap(origin, passengerLocation);
await getMapDestination(passengerLocation, passengerDestination); isHaveSteps == 'haveSteps'
? (
await getMapDestination(step0, step1),
await getMapDestination(step1, step2),
await getMapDestination(step2, step3),
await getMapDestination(step3, step4),
)
: await getMapDestination(passengerLocation, passengerDestination);
addCustomCarIcon(); addCustomCarIcon();
// updateMarker(); // updateMarker();
startTimerToShowPassengerInfoWindowFromDriver(); startTimerToShowPassengerInfoWindowFromDriver();

View File

@@ -67,12 +67,12 @@ class MapPassengerController extends GetxController {
late LatLng newPointLocation3 = const LatLng(32.115295, 36.064773); late LatLng newPointLocation3 = const LatLng(32.115295, 36.064773);
late LatLng newPointLocation4 = const LatLng(32.115295, 36.064773); late LatLng newPointLocation4 = const LatLng(32.115295, 36.064773);
LatLng myDestination = const LatLng(32.115295, 36.064773); LatLng myDestination = const LatLng(32.115295, 36.064773);
final List<LatLng> polylineCoordinates = []; List<LatLng> polylineCoordinates = [];
final List<LatLng> polylineCoordinates0 = []; List<LatLng> polylineCoordinates0 = [];
final List<LatLng> polylineCoordinates1 = []; List<LatLng> polylineCoordinates1 = [];
final List<LatLng> polylineCoordinates2 = []; List<LatLng> polylineCoordinates2 = [];
final List<LatLng> polylineCoordinates3 = []; List<LatLng> polylineCoordinates3 = [];
final List<LatLng> polylineCoordinates4 = []; List<LatLng> polylineCoordinates4 = [];
List<List<LatLng>> polylineCoordinatesPointsAll = []; List<List<LatLng>> polylineCoordinatesPointsAll = [];
List<LatLng> carsLocationByPassenger = []; List<LatLng> carsLocationByPassenger = [];
List<LatLng> driverCarsLocationToPassengerAfterApplied = []; List<LatLng> driverCarsLocationToPassengerAfterApplied = [];
@@ -187,7 +187,8 @@ class MapPassengerController extends GetxController {
late Duration durationToAdd; late Duration durationToAdd;
late DateTime newTime = DateTime.now(); late DateTime newTime = DateTime.now();
int hours = 0;
int minutes = 0;
void onChangedPassengerCount(int newValue) { void onChangedPassengerCount(int newValue) {
selectedPassengerCount = newValue; selectedPassengerCount = newValue;
update(); update();
@@ -573,7 +574,15 @@ class MapPassengerController extends GetxController {
rideTimerBegin.toString(), rideTimerBegin.toString(),
dataCarsLocationByPassenger['message'][carsOrder]['driver_id'] dataCarsLocationByPassenger['message'][carsOrder]['driver_id']
.toString(), .toString(),
durationToRide.toString() durationToRide.toString(),
Get.find<WayPointController>().wayPoints.length > 1
? 'haveSteps'
: 'startEnd',
placesCoordinate[0],
placesCoordinate[1],
placesCoordinate[2],
placesCoordinate[3],
placesCoordinate[4],
]; ];
FirebaseMessagesController().sendNotificationToDriverMAP( FirebaseMessagesController().sendNotificationToDriverMAP(
'Order', 'Order',
@@ -636,6 +645,14 @@ class MapPassengerController extends GetxController {
cancelRideAfterRejectFromAll(); cancelRideAfterRejectFromAll();
} }
} else if (decod['data'].toString() == 'Cancel') {
remainingTime = 0;
shouldFetch = false;
rideConfirm = false;
FirebaseMessagesController().sendNotificationToDriverMAP(
'Trip Canceled'.tr, '', driverToken, []);
update();
} else { } else {
delayAndFetchRideStatus( delayAndFetchRideStatus(
rideId); // Repeat the delay and fetch operation rideId); // Repeat the delay and fetch operation
@@ -807,6 +824,7 @@ class MapPassengerController extends GetxController {
"status": 'Cancel' "status": 'Cancel'
}); });
rideConfirm = false; rideConfirm = false;
totalStepDurations = 0;
shouldFetch = false; shouldFetch = false;
isPassengerChosen = false; isPassengerChosen = false;
isCashConfirmPageShown = false; isCashConfirmPageShown = false;
@@ -825,6 +843,7 @@ class MapPassengerController extends GetxController {
if (rideConfirm == false) { if (rideConfirm == false) {
clearPlacesDestination(); clearPlacesDestination();
clearPolyline(); clearPolyline();
// clearPolylineAll();
data = []; data = [];
changeCancelRidePageShow(); changeCancelRidePageShow();
rideConfirm = false; rideConfirm = false;
@@ -834,6 +853,7 @@ class MapPassengerController extends GetxController {
isCashSelectedBeforeConfirmRide = false; isCashSelectedBeforeConfirmRide = false;
isPickerShown = false; isPickerShown = false;
totalStepDurations = 0; totalStepDurations = 0;
totalStepDurations = 0;
timeToPassengerFromDriverAfterApplied = 0; timeToPassengerFromDriverAfterApplied = 0;
update(); update();
} else { } else {
@@ -852,7 +872,9 @@ class MapPassengerController extends GetxController {
isCashSelectedBeforeConfirmRide = false; isCashSelectedBeforeConfirmRide = false;
timeToPassengerFromDriverAfterApplied = 0; timeToPassengerFromDriverAfterApplied = 0;
totalStepDurations = 0; totalStepDurations = 0;
totalStepDurations = 0;
changeCancelRidePageShow(); changeCancelRidePageShow();
// clearPolylineAll();
remainingTime = 0; remainingTime = 0;
update(); update();
@@ -1073,9 +1095,27 @@ class MapPassengerController extends GetxController {
void clearPolyline() { void clearPolyline() {
polyLines = []; polyLines = [];
polylineCoordinates.clear(); polylineCoordinates.clear();
// polylineCoordinates = [];
polylineCoordinatesPointsAll[0].clear();
polylineCoordinatesPointsAll[1].clear();
polylineCoordinatesPointsAll[2].clear();
polylineCoordinatesPointsAll[3].clear();
polylineCoordinatesPointsAll[4].clear();
update(); update();
} }
// void clearPolylineAll() {
// polylineCoordinatesPointsAll[0].clear();
// polylineCoordinatesPointsAll[1].clear();
// polylineCoordinatesPointsAll[2].clear();
// polylineCoordinatesPointsAll[3].clear();
// polylineCoordinatesPointsAll[4].clear();
// polyLines = [];
// polylineCoordinates.clear();
// update();
// }
void addCustomPicker() { void addCustomPicker() {
ImageConfiguration config = const ImageConfiguration( ImageConfiguration config = const ImageConfiguration(
size: Size(20, 20), size: Size(20, 20),
@@ -1111,9 +1151,9 @@ class MapPassengerController extends GetxController {
} }
void addCustomCarIcon() { void addCustomCarIcon() {
ImageConfiguration config = ImageConfiguration( ImageConfiguration config = const ImageConfiguration(
size: Size(Get.width * .6, Get.height * .6), // size: Size(Get.width * .6, Get.height * .6),
// size: Size(20, 20), size: Size(20, 20),
// scale: 1.0, // scale: 1.0,
); );
BitmapDescriptor.fromAssetImage(config, 'assets/images/car.png') BitmapDescriptor.fromAssetImage(config, 'assets/images/car.png')
@@ -1414,19 +1454,23 @@ class MapPassengerController extends GetxController {
int totalStepDurations = 0; int totalStepDurations = 0;
getMapPoints(String origin, String destination, int index) async { getMapPoints(String origin, String destination, int index) async {
isWayPointStopsSheetUtilGetMap = false; isWayPointStopsSheetUtilGetMap = false;
await getCarsLocationByPassenger(); await getCarsLocationByPassenger();
isLoading = false; isLoading = false;
update(); update();
var url = var url =
('${AppLink.googleMapsLink}directions/json?&language=en&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AK.mapAPIKEY}'); ('${AppLink.googleMapsLink}directions/json?&language=en&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AK.mapAPIKEY}');
print(url); // print(url);
var response = await CRUD().getGoogleApi(link: url, payload: {}); var response = await CRUD().getGoogleApi(link: url, payload: {});
data = response['routes'][0]['legs']; data = response['routes'][0]['legs'];
// print(data); // print(data);
isLoading = false; isLoading = false;
int durationToRide0 = data[0]['duration']['value'];
durationToRide = durationToRide + durationToRide0;
print('durationToRide is ${data[0]['duration']['value']}');
print('totalStepDurations is $durationToRide');
update(); update();
durationToRide = durationToRide + int.parse(data[0]['duration']['value']);
// totalStepDurations = totalStepDurations + durationToRide;
final points = final points =
decodePolyline(response["routes"][0]["overview_polyline"]["points"]); decodePolyline(response["routes"][0]["overview_polyline"]["points"]);
for (int i = 0; i < points.length; i++) { for (int i = 0; i < points.length; i++) {
@@ -1452,20 +1496,20 @@ class MapPassengerController extends GetxController {
// Animate the camera to the adjusted bounds // Animate the camera to the adjusted bounds
if (distanceOfDestnation <= 5) { if (distanceOfDestnation <= 5) {
mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 14)); mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 15));
} else if (distanceOfDestnation > 5 && distanceOfDestnation <= 8) { } else if (distanceOfDestnation > 5 && distanceOfDestnation <= 8) {
mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 13)); mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 14));
} else if (distanceOfDestnation > 8 && distanceOfDestnation < 16) { } else if (distanceOfDestnation > 8 && distanceOfDestnation < 16) {
mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 12)); mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 13));
} else if (distanceOfDestnation >= 16 && distanceOfDestnation < 30) { } else if (distanceOfDestnation >= 16 && distanceOfDestnation < 30) {
mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 11)); mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 11));
} else if (distanceOfDestnation >= 30 && distanceOfDestnation < 100) { } else if (distanceOfDestnation >= 30 && distanceOfDestnation < 100) {
mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 10)); mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 9));
} else if (distanceOfDestnation >= 100) { } else if (distanceOfDestnation >= 100) {
mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 7)); mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 7));
} }
if (polyLines.isNotEmpty) { if (polyLines.isNotEmpty) {
clearPolyline(); // clearPolyline();
} else { } else {
var polyline = Polyline( var polyline = Polyline(
polylineId: PolylineId(response["routes"][0]["summary"]), polylineId: PolylineId(response["routes"][0]["summary"]),
@@ -1540,18 +1584,21 @@ class MapPassengerController extends GetxController {
print('================================='); print('=================================');
distance = getDistanceFromText(distanceText); distance = getDistanceFromText(distanceText);
duration = getDistanceFromText(durationText); duration = getDistanceFromText(durationText);
durationToAdd = Duration(minutes: duration.toInt()); durationToAdd = Duration(seconds: durationToRide);
print('durationToRide----- $durationToRide');
hours = durationToAdd.inHours;
minutes = (durationToAdd.inMinutes % 60).round();
DateTime currentTime = DateTime.now(); DateTime currentTime = DateTime.now();
newTime = currentTime.add(durationToAdd); newTime = currentTime.add(durationToAdd);
averageDuration = duration / distance; averageDuration = (durationToRide / 60) / distance;
costDuration = duration * averageDuration * 0.016; costDuration = (durationToRide / 60) * averageDuration * 0.016;
var totalDriver1 = cost + costDuration; var totalDriver1 = cost + costDuration;
totalPassenger = totalDriver1 + (totalDriver1 * .16); totalPassenger = totalDriver1 + (totalDriver1 * .16);
totalDriver = totalDriver1 + (totalDriver1 * .16); totalDriver = totalDriver1 + (totalDriver1 * .16);
tax = totalPassenger * .04; tax = totalPassenger * .16;
totalME = totalPassenger - totalDriver - tax; totalME = totalPassenger - tax;
update(); update();
if (currentTime.hour >= 21) { if (currentTime.hour >= 22) {
if (distanceText.contains('km')) { if (distanceText.contains('km')) {
cost = distance * 0.23; cost = distance * 0.23;
update(); update();
@@ -1570,7 +1617,7 @@ class MapPassengerController extends GetxController {
} else if (currentTime.hour >= 13 && currentTime.hour <= 16) { } else if (currentTime.hour >= 13 && currentTime.hour <= 16) {
if (averageDuration > 2.5) { if (averageDuration > 2.5) {
if (distanceText.contains('km')) { if (distanceText.contains('km')) {
cost = distance * 0.23; cost = distance * 0.25;
update(); update();
} else { } else {
cost = distance * 0.25 / 1000; cost = distance * 0.25 / 1000;
@@ -1599,8 +1646,8 @@ class MapPassengerController extends GetxController {
totalPassenger = 1; totalPassenger = 1;
update(); update();
if (totalDriver < .5) { if (totalDriver < .5) {
totalDriver = .80; totalDriver = .75;
totalME = .16; totalME = .21;
update(); update();
} else { } else {
totalDriver = .90; totalDriver = .90;

View File

@@ -20,6 +20,7 @@ class SplashScreenController extends GetxController
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
animationController = AnimationController( animationController = AnimationController(
vsync: this, vsync: this,
duration: const Duration(seconds: 7), duration: const Duration(seconds: 7),

View File

@@ -7,6 +7,7 @@ import '../themes/themes.dart';
class LocaleController extends GetxController { class LocaleController extends GetxController {
Locale? language; Locale? language;
String countryCode = '';
void restartApp() { void restartApp() {
runApp(const MyApp()); runApp(const MyApp());
} }
@@ -30,11 +31,13 @@ class LocaleController extends GetxController {
break; break;
default: default:
locale = Locale(Get.deviceLocale!.languageCode); locale = Locale(Get.deviceLocale!.languageCode);
appTheme = themeEnglish; appTheme = themeEnglish;
break; break;
} }
box.write(BoxName.lang, langcode); box.write(BoxName.lang, langcode);
// box.write(BoxName.lang, langcode);
Get.changeTheme(appTheme); Get.changeTheme(appTheme);
Get.updateLocale(locale); Get.updateLocale(locale);
restartApp(); restartApp();

View File

@@ -35,7 +35,8 @@ void main() async {
await GetStorage.init(); await GetStorage.init();
await AC().gAK(); await AC().gAK();
print( print(
'local is ${WidgetsBinding.instance.platformDispatcher.locale.countryCode}'); 'local is t ${WidgetsBinding.instance.platformDispatcher.locale.countryCode}');
print(Get.deviceLocale!.countryCode);
Stripe.publishableKey = AK.publishableKey; Stripe.publishableKey = AK.publishableKey;
//StripeKey.publishableKey; //StripeKey.publishableKey;

View File

@@ -1,90 +1,391 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:ride/constant/colors.dart'; import 'package:ride/constant/colors.dart';
import 'package:ride/constant/links.dart';
import 'package:ride/constant/style.dart'; import 'package:ride/constant/style.dart';
import 'package:ride/constant/table_names.dart'; import 'package:ride/constant/table_names.dart';
import 'package:ride/controller/auth/captin/register_captin_controller.dart'; import 'package:ride/controller/auth/captin/register_captin_controller.dart';
import 'package:ride/controller/functions/ocr_controller.dart'; import 'package:ride/controller/functions/ocr_controller.dart';
import 'package:ride/main.dart'; import 'package:ride/main.dart';
import 'package:ride/views/auth/captin/car_license_page.dart';
import 'package:ride/views/widgets/elevated_btn.dart'; import 'package:ride/views/widgets/elevated_btn.dart';
import 'package:ride/views/widgets/my_scafold.dart'; import 'package:ride/views/widgets/my_scafold.dart';
import 'package:ride/views/widgets/mycircular.dart'; import 'package:ride/views/widgets/mycircular.dart';
import '../../../controller/functions/gemeni.dart';
class AiPage extends StatelessWidget { class AiPage extends StatelessWidget {
ScanDocumentsByApi scanDocumentsByApi = Get.put(ScanDocumentsByApi()); ScanDocumentsByApi scanDocumentsByApi = Get.put(ScanDocumentsByApi());
RegisterCaptainController registerCaptainController = RegisterCaptainController registerCaptainController =
Get.put(RegisterCaptainController()); Get.put(RegisterCaptainController());
ContentController contentController = Get.put(ContentController());
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MyScafolld( return MyScafolld(
title: 'AI Page'.tr, title: 'AI Page'.tr,
body: [ body: [
Positioned( Get.deviceLocale!.countryCode != 'US'
top: 3, ? Positioned(
left: Get.width * .2, top: 3,
right: Get.width * .2, left: Get.width * .2,
child: MyElevatedButton( right: Get.width * .2,
title: 'Take Picture Of ID Card'.tr, child: MyElevatedButton(
onPressed: () { title: 'Take Picture Of ID Card'.tr,
scanDocumentsByApi.scanDocumentsByApi(); onPressed: () {
}, scanDocumentsByApi.scanDocumentsByApi();
)), },
GetBuilder<ScanDocumentsByApi>( ))
builder: (scanDocumentsByApi) => scanDocumentsByApi : Positioned(
.responseMap.isNotEmpty top: 3,
? Positioned( left: Get.width * .1,
top: Get.height * .06, right: Get.width * .1,
left: Get.width * .051, child: MyElevatedButton(
right: Get.width * .051, title: 'Take Picture Of Driver License Card'.tr,
child: scanDocumentsByApi.isLoading onPressed: () {
? Column( contentController.generateDriverLicenseJordanContent();
children: [ },
const MyCircularProgressIndicator(), )),
Text( Get.deviceLocale!.countryCode != 'US'
'We are process picture please wait '.tr, ? GetBuilder<ScanDocumentsByApi>(
style: AppStyle.title, builder: (scanDocumentsByApi) => scanDocumentsByApi
) .responseMap.isNotEmpty
], ? Positioned(
) top: Get.height * .06,
: Column( left: Get.width * .051,
children: [ right: Get.width * .051,
Container( child: scanDocumentsByApi.isLoading
decoration: AppStyle.boxDecoration, ? Column(
height: Get.height * .4, children: [
child: Padding( const MyCircularProgressIndicator(),
padding: const EdgeInsets.all(5), Text(
child: scanDocumentsByApi.responseMap.isEmpty 'We are process picture please wait '.tr,
? Center( style: AppStyle.title,
child: Text( )
'There is no data yet.'.tr, ],
style: AppStyle.title, )
: Column(
children: [
Container(
decoration: AppStyle.boxDecoration,
height: Get.height * .4,
child: Padding(
padding: const EdgeInsets.all(5),
child: scanDocumentsByApi
.responseMap.isEmpty
? Center(
child: Text(
'There is no data yet.'.tr,
style: AppStyle.title,
),
)
: Column(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: <Widget>[
Column(
mainAxisAlignment:
MainAxisAlignment
.start,
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
Text(
'Name :${scanDocumentsByApi.name}',
style: AppStyle
.subtitle,
),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'Drivers License Class: ${scanDocumentsByApi.licenseClass}',
style: AppStyle
.title,
),
Image.memory(
scanDocumentsByApi
.imageSignature,
width: 100,
height: 30,
),
],
),
],
),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'Document Number: ${scanDocumentsByApi.documentNo}',
style: AppStyle.title,
),
Image.memory(
scanDocumentsByApi
.imagePortrait,
width: 60,
),
]),
Text(
'Address: ${scanDocumentsByApi.address}',
style: AppStyle.title,
),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'Height: ${scanDocumentsByApi.height}',
style:
AppStyle.subtitle,
),
Text(
'Postal Code: ${scanDocumentsByApi.postalCode}',
style:
AppStyle.subtitle,
),
Text(
'Sex: ${scanDocumentsByApi.sex}',
style:
AppStyle.subtitle,
),
],
),
Text(
'Territorial Code: ${scanDocumentsByApi.stateCode}',
style: AppStyle.subtitle,
),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'Expiry Date: ${scanDocumentsByApi.expireDate}',
style: DateTime.parse(scanDocumentsByApi
.responseMap['data']
['ocr'][
'dateOfExpiry']
.toString())
.isBefore(
scanDocumentsByApi
.now)
? AppStyle.title
.copyWith(
color: AppColor
.redColor)
: AppStyle.title.copyWith(
color: AppColor
.greenColor),
),
Text(
'Date of Birth: ${scanDocumentsByApi.dob}',
style: AppStyle.title,
),
],
),
],
),
),
),
DateTime.parse(scanDocumentsByApi
.responseMap['data']['ocr']
['dateOfExpiry']
.toString())
.isBefore(scanDocumentsByApi.now)
? Text(
'You can\'t continue with us .\nYou should renew Driver license',
style: AppStyle.title.copyWith(
color: AppColor.redColor),
)
: MyElevatedButton(
title: 'Detect Your Face '.tr,
onPressed: () => scanDocumentsByApi
.checkMatchFaceApi(),
), ),
) scanDocumentsByApi.res.isEmpty
: Column( ? const SizedBox()
mainAxisAlignment: : scanDocumentsByApi.res['data']
MainAxisAlignment.spaceBetween, ['result']
crossAxisAlignment: .toString() ==
CrossAxisAlignment.start, 'Same'
children: [ ? MyElevatedButton(
Row( onPressed: () async {
mainAxisAlignment: await registerCaptainController
MainAxisAlignment .register();
.spaceBetween, await registerCaptainController
children: <Widget>[ .addLisence();
Column( // await scanDocumentsByApi
// .uploadImagePortrate();
},
title:
'Go to next step\nscan Car License.'
.tr,
kolor: AppColor.greenColor,
)
: const SizedBox(),
MyElevatedButton(
title: 'get sql data',
kolor: AppColor.yellowColor,
onPressed: () {
sql.deleteAllData(
TableName.faceDetectTimes);
sql
.getAllData(
TableName.faceDetectTimes)
.then((value) => print(
value[0]['faceDetectTimes']));
},
)
],
),
)
: Positioned(
top: Get.height * .06,
left: Get.width * .051,
right: Get.width * .051,
child: scanDocumentsByApi.isLoading
? Column(
children: [
const MyCircularProgressIndicator(),
Text(
'We are process picture please wait '.tr,
style: AppStyle.title,
)
],
)
: Column(
children: [
Container(
decoration: AppStyle.boxDecoration,
height: Get.height * .35,
child: Padding(
padding: const EdgeInsets.all(5),
child: Center(
child: Text(
'There is no data yet.'.tr,
style: AppStyle.title,
),
)),
),
],
),
),
)
: GetBuilder<ContentController>(
builder: (contentController) => contentController
.responseMap.isNotEmpty
? Positioned(
top: Get.height * .09,
left: Get.width * .051,
right: Get.width * .051,
child: contentController.isloading
? Column(
children: [
const MyCircularProgressIndicator(),
Text(
'We are process picture please wait '.tr,
style: AppStyle.title,
)
],
)
: SizedBox(
height: Get.height * .7,
child: ListView(
children: [
Container(
decoration: AppStyle.boxDecoration,
// height: Get.height * .4,
child: Padding(
padding: const EdgeInsets.all(5),
child: contentController
.responseMap.isEmpty
? Center(
child: Text(
'There is no data yet.'.tr,
style: AppStyle.title,
),
)
: Column(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.start, MainAxisAlignment
.spaceBetween,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: <Widget>[
Column(
mainAxisAlignment:
MainAxisAlignment
.start,
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
Row(
children: [
Text(
'${'Name'.tr} :${contentController.responseMap['first_name']}',
style: AppStyle
.subtitle,
),
Text(
' ${contentController.responseMap['last_name']}',
style: AppStyle
.subtitle,
),
],
),
Text(
'${'Name in arabic'.tr}: ${contentController.responseMap['name_in_arabic']}',
style: AppStyle
.title,
),
Text(
'${'Drivers License Class'.tr}: ${contentController.responseMap['class']}',
style: AppStyle
.title,
),
],
),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'${'National Number'.tr}: ${contentController.responseMap['id']}',
style:
AppStyle.title,
),
// Image.memory(
// scanDocumentsByApi
// .imagePortrait,
// width: 60,
// ),
]),
Text( Text(
'Name :${scanDocumentsByApi.name}', '${'Address'.tr}: ${contentController.responseMap['address']}',
style: AppStyle.subtitle, style: AppStyle.title,
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment:
@@ -92,177 +393,250 @@ class AiPage extends StatelessWidget {
.spaceBetween, .spaceBetween,
children: [ children: [
Text( Text(
'Drivers License Class: ${scanDocumentsByApi.licenseClass}', '${'Date of Birth'.tr}: ${contentController.responseMap['dob']}',
style: AppStyle.title, style: AppStyle.title,
), ),
Image.memory( Text(
scanDocumentsByApi '${'Age'.tr} : ${contentController.responseMap['age_in_years']}',
.imageSignature, style: AppStyle.title,
width: 100, ),
height: 30, ],
),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'${'Expiry Date'.tr}: ${contentController.responseMap['expiration_date']}',
style: DateTime.parse(contentController
.responseMap[
'expiration_date']
.toString())
.isBefore(
contentController
.now)
? AppStyle.title.copyWith(
color: AppColor
.redColor)
: AppStyle.title.copyWith(
color: AppColor
.greenColor),
), ),
], ],
), ),
], ],
), ),
], ),
), ),
Row( const SizedBox(
mainAxisAlignment: height: 10,
MainAxisAlignment ),
.spaceBetween, DateTime.parse(contentController
.responseMap[
'expiration_date']
.toString())
.isBefore(contentController.now)
? Text(
'You can\'t continue with us .\nYou should renew Driver license'
.tr,
style: AppStyle.title.copyWith(
color: AppColor.redColor),
)
: MyElevatedButton(
kolor: AppColor.greenColor,
title:
'Lets check Car license '.tr,
onPressed: () => contentController
.generateCarLicenseJordanContent()),
const SizedBox(
height: 10,
),
contentController
.responseCarLicenseMap.isNotEmpty
? Container(
decoration:
AppStyle.boxDecoration,
// height: Get.height * .3,
width: Get.width * .9,
child: Column(
children: [ children: [
Text( Text(
'Document Number: ${scanDocumentsByApi.documentNo}', '${'Name'.tr} ${contentController.responseCarLicenseMap['name']}',
style: AppStyle.title, style: AppStyle.title,
), ),
Image.memory( Text(
scanDocumentsByApi '${'Address'.tr} ${contentController.responseCarLicenseMap['address']}',
.imagePortrait, style: AppStyle.title,
width: 60,
), ),
]), Text(
Text( '${'Car Kind'.tr} ${contentController.responseCarLicenseMap['car_kind']}',
'Address: ${scanDocumentsByApi.address}', style: AppStyle.title,
style: AppStyle.title, ),
), Text(
Row( '${'Color'.tr} ${contentController.responseCarLicenseMap['car_color']}',
mainAxisAlignment: style: AppStyle.title,
MainAxisAlignment ),
.spaceBetween, Text(
children: [ '${'Year'.tr} ${contentController.responseCarLicenseMap['car_year']}',
style: AppStyle.title,
),
Text(
'${'Car Plate'.tr} ${contentController.responseCarLicenseMap['car_plate']}',
style: AppStyle.title,
),
Text(
'${'Car Expire'.tr} ${contentController.responseCarLicenseMap['expire_date_of_license']}',
style: contentController
.responseCarLicenseMap
.isNotEmpty
? DateTime.parse(contentController
.responseCarLicenseMap[
'expire_date_of_license']
.toString())
.isBefore(contentController
.now)
? AppStyle.title.copyWith(
color: AppColor
.redColor)
: AppStyle.title.copyWith(
color: AppColor
.greenColor)
: null,
),
],
),
)
: const SizedBox(),
const SizedBox(
height: 10,
),
// DateTime.parse(contentController
// .responseCarLicenseMap[
// 'expire_date_of_license']
// .toString())
// .isBefore(contentController.now)
// ? Text(
// 'You can\'t continue with us .\nYou should renew Car license'
// .tr,
// style: AppStyle.title.copyWith(
// color: AppColor.redColor),
// )
// :
MyElevatedButton(
kolor: AppColor.greenColor,
title:
'Lets check License Back Face'.tr,
onPressed: () => contentController
.generateBackCarLicenseJordanContent()),
const SizedBox(
height: 10,
),
contentController
.responseBackCarLicenseMap
.isNotEmpty
? Container(
decoration:
AppStyle.boxDecoration,
// height: 300,
child: Column(children: [
Text( Text(
'Height: ${scanDocumentsByApi.height}', 'VIN ${contentController.responseBackCarLicenseMap['vin']}',
style: AppStyle.subtitle,
),
Text(
'Postal Code: ${scanDocumentsByApi.postalCode}',
style: AppStyle.subtitle,
),
Text(
'Sex: ${scanDocumentsByApi.sex}',
style: AppStyle.subtitle,
),
],
),
Text(
'Territorial Code: ${scanDocumentsByApi.stateCode}',
style: AppStyle.subtitle,
),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'Expiry Date: ${scanDocumentsByApi.expireDate}',
style: DateTime.parse(
scanDocumentsByApi
.responseMap['data']
['ocr'][
'dateOfExpiry']
.toString())
.isBefore(
scanDocumentsByApi
.now)
? AppStyle.title.copyWith(
color:
AppColor.redColor)
: AppStyle.title.copyWith(
color: AppColor
.greenColor),
),
Text(
'Date of Birth: ${scanDocumentsByApi.dob}',
style: AppStyle.title, style: AppStyle.title,
), ),
], Text(
), 'Fuel Type ${contentController.responseBackCarLicenseMap['fuelType']}',
], style: AppStyle.title,
), ),
Text(
'Insurance Company ${contentController.responseBackCarLicenseMap['insuranceCompany']}',
style: AppStyle.title,
),
Text(
'Policy Number ${contentController.responseBackCarLicenseMap['policyNumber']}',
style: AppStyle.title,
),
Text(
'Insurance Type ${contentController.responseBackCarLicenseMap['insuranceType']}',
style: AppStyle.title,
)
]))
: const SizedBox()
// MyElevatedButton(
// title: 'Detect Your Face '.tr,
// onPressed: () => scanDocumentsByApi
// .checkMatchFaceApi(),
// ),
// scanDocumentsByApi.res.isEmpty
// ? const SizedBox()
// : scanDocumentsByApi.res['data']
// ['result']
// .toString() ==
// 'Same'
// ? MyElevatedButton(
// onPressed: () async {
// await registerCaptainController
// .register();
// await registerCaptainController
// .addLisence();
// // await scanDocumentsByApi
// // .uploadImagePortrate();
// },
// title:
// 'Go to next step\nscan Car License.'
// .tr,
// kolor: AppColor.greenColor,
// )
// : const SizedBox(),
// MyElevatedButton(
// title: 'get sql data',
// kolor: AppColor.yellowColor,
// onPressed: () {
// sql.deleteAllData(
// TableName.faceDetectTimes);
// sql
// .getAllData(
// TableName.faceDetectTimes)
// .then((value) => print(
// value[0]['faceDetectTimes']));
// },
// ),
],
),
), ),
), )
DateTime.parse(scanDocumentsByApi : Positioned(
.responseMap['data']['ocr'] top: Get.height * .06,
['dateOfExpiry'] left: Get.width * .051,
.toString()) right: Get.width * .051,
.isBefore(scanDocumentsByApi.now) child: scanDocumentsByApi.isLoading
? Text( ? Column(
'You can\'t continue with us .\nYou should renew Driver license', children: [
style: AppStyle.title const MyCircularProgressIndicator(),
.copyWith(color: AppColor.redColor), Text(
'We are process picture please wait '.tr,
style: AppStyle.title,
) )
: MyElevatedButton( ],
title: 'Detect Your Face '.tr, )
onPressed: () => scanDocumentsByApi : Column(
.checkMatchFaceApi(), children: [
Container(
decoration: AppStyle.boxDecoration,
height: Get.height * .35,
child: Padding(
padding: const EdgeInsets.all(5),
child: Center(
child: Text(
'There is no data yet.'.tr,
style: AppStyle.title,
),
)),
), ),
scanDocumentsByApi.res.isEmpty ],
? const SizedBox() ),
: scanDocumentsByApi.res['data']['result'] ),
.toString() == )
'Same'
? MyElevatedButton(
onPressed: () async {
await registerCaptainController
.register();
await registerCaptainController
.addLisence();
// await scanDocumentsByApi
// .uploadImagePortrate();
},
title:
'Go to next step\nscan Car License.'
.tr,
kolor: AppColor.greenColor,
)
: const SizedBox(),
MyElevatedButton(
title: 'get sql data',
kolor: AppColor.yellowColor,
onPressed: () {
sql.deleteAllData(TableName.faceDetectTimes);
sql
.getAllData(TableName.faceDetectTimes)
.then((value) =>
print(value[0]['faceDetectTimes']));
},
)
],
),
)
: Positioned(
top: Get.height * .06,
left: Get.width * .051,
right: Get.width * .051,
child: scanDocumentsByApi.isLoading
? Column(
children: [
const MyCircularProgressIndicator(),
Text(
'We are process picture please wait '.tr,
style: AppStyle.title,
)
],
)
: Column(
children: [
Container(
decoration: AppStyle.boxDecoration,
height: Get.height * .35,
child: Padding(
padding: const EdgeInsets.all(5),
child: Center(
child: Text(
'There is no data yet.'.tr,
style: AppStyle.title,
),
)),
),
],
),
),
),
], ],
isleading: true); isleading: true);
} }

View File

@@ -24,6 +24,7 @@ class LoginCaptin extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Get.put(LoginCaptinController()); Get.put(LoginCaptinController());
return GetBuilder<LoginCaptinController>( return GetBuilder<LoginCaptinController>(
builder: (controller) => MyScafolld( builder: (controller) => MyScafolld(
title: 'Login Captin'.tr, title: 'Login Captin'.tr,

View File

@@ -1,7 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:ride/controller/auth/captin/register_captin_controller.dart'; import 'package:ride/controller/auth/captin/register_captin_controller.dart';
import 'package:ride/views/auth/captin/car_license_page.dart';
import 'package:ride/views/widgets/elevated_btn.dart'; import 'package:ride/views/widgets/elevated_btn.dart';
import 'package:ride/views/widgets/my_scafold.dart'; import 'package:ride/views/widgets/my_scafold.dart';

View File

@@ -13,6 +13,7 @@ import '../../../../controller/home/captin/home_captain_controller.dart';
import '../../../../controller/home/captin/order_request_controller.dart'; import '../../../../controller/home/captin/order_request_controller.dart';
import '../../../../controller/home/captin/widget/connect.dart'; import '../../../../controller/home/captin/widget/connect.dart';
import '../../../../controller/home/captin/widget/left_menu_map_captain.dart'; import '../../../../controller/home/captin/widget/left_menu_map_captain.dart';
import '../../../../controller/local/local_controller.dart';
import '../../../../main.dart'; import '../../../../main.dart';
import '../../../widgets/circle_container.dart'; import '../../../widgets/circle_container.dart';
@@ -26,6 +27,7 @@ class HomeCaptain extends StatelessWidget {
Get.put(OrderRequestController()); Get.put(OrderRequestController());
Get.put(HomeCaptainController()); Get.put(HomeCaptainController());
// Get.put(HomeCaptainController()); // Get.put(HomeCaptainController());
print('local is ${Get.find<LocaleController>().language!.countryCode}');
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
backgroundColor: AppColor.greenColor, backgroundColor: AppColor.greenColor,

View File

@@ -45,7 +45,12 @@ class OrderRequestPage extends StatelessWidget {
launchUrl1(mapUrl); launchUrl1(mapUrl);
}, },
icon: const Icon(Icons.map), icon: const Icon(Icons.map),
label: Text('Rouats of Trip'.tr)), label: myList[20].toString() == 'haveSteps'
? Text(
'Trip has Steps'.tr,
style: AppStyle.title,
)
: Text('Rouats of Trip'.tr, style: AppStyle.title)),
myList[13].toString() == myList[13].toString() ==
'true' //Visa or Cash Method from notify to driver 'true' //Visa or Cash Method from notify to driver
? Text( ? Text(
@@ -206,7 +211,13 @@ class OrderRequestPage extends StatelessWidget {
'durationOfRideValue': myList[19].toString(), 'durationOfRideValue': myList[19].toString(),
'paymentAmount': myList[3].toString(), 'paymentAmount': myList[3].toString(),
'paymentMethod': 'paymentMethod':
myList[13].toString() == 'true' ? 'visa' : 'cash' myList[13].toString() == 'true' ? 'visa' : 'cash',
'isHaveSteps': myList[20].toString(),
'step0': myList[21].toString(),
'step1': myList[22].toString(),
'step2': myList[23].toString(),
'step3': myList[24].toString(),
'step4': myList[25].toString(),
}); });
}, },
), ),

View File

@@ -71,7 +71,9 @@ GetBuilder<MapPassengerController> buttomSheetMapPage() {
MainAxisAlignment.spaceEvenly, MainAxisAlignment.spaceEvenly,
children: [ children: [
Text( Text(
'${'Your Ride Duration is '.tr}${controller.duration} minutes', controller.hours > 1
? '${'Your Ride Duration is '.tr}${controller.hours} H and ${controller.minutes} m'
: '${'Your Ride Duration is '.tr} ${controller.minutes} m',
style: AppStyle.subtitle, style: AppStyle.subtitle,
), ),
Text( Text(

View File

@@ -57,18 +57,28 @@ class PointsPageForRider extends StatelessWidget {
controller.clearPolyline(); controller.clearPolyline();
controller.isWayPointStopsSheetUtilGetMap = controller.isWayPointStopsSheetUtilGetMap =
false; false;
mapPassengerController.durationToRide = 0;
for (var i = 0; for (var i = 0;
i < wayPointController.wayPoints.length; i < wayPointController.wayPoints.length;
i++) { i++) {
mapPassengerController.getMapPoints( if (mapPassengerController
mapPassengerController.placesCoordinate[i] .placesCoordinate[i + 1]
.toString(), .toString() !=
mapPassengerController '') {
.placesCoordinate[i + 1] mapPassengerController.getMapPoints(
.toString(), mapPassengerController
i, .placesCoordinate[i]
); .toString(),
mapPassengerController
.placesCoordinate[i + 1]
.toString(),
i,
);
}
} }
controller.bottomSheet();
controller.showBottomSheet1();
}, },
child: const Text('Get Map'), child: const Text('Get Map'),
) )

View File

@@ -74,8 +74,9 @@ class RideBeginPassenger extends StatelessWidget {
.phone, // Set the keyboard type to phone .phone, // Set the keyboard type to phone
validator: (value) { validator: (value) {
if (value!.isEmpty || if (value!.isEmpty ||
value.length < 10) { value.length != 10) {
return 'Please enter a phone number'; return 'Please enter a valid phone number'
.tr;
} }
// Add additional validation if needed // Add additional validation if needed
return null; return null;