This commit is contained in:
Hamza-Ayed
2024-06-09 18:38:15 +03:00
parent b5badb8f2e
commit a13f9254ae
5 changed files with 220 additions and 132 deletions

View File

@@ -16,6 +16,7 @@ class BoxName {
static const String agreeTerms = "agreeTerms"; static const String agreeTerms = "agreeTerms";
static const String addWork = 'addWork'; static const String addWork = 'addWork';
static const String addHome = 'addHome'; static const String addHome = 'addHome';
static const String rideArguments = 'rideArguments';
static const String durationData = 'durationData'; static const String durationData = 'durationData';
static const String rideStaticDriverData = 'rideStaticDriverData'; static const String rideStaticDriverData = 'rideStaticDriverData';
static const String lastTimeStaticThrottle = 'lastTimeStaticThrottle'; static const String lastTimeStaticThrottle = 'lastTimeStaticThrottle';

View File

@@ -882,18 +882,19 @@ class MapDriverController extends GetxController {
// var coordDestination = passengerDestination.toString().split(','); // var coordDestination = passengerDestination.toString().split(',');
// Parse to double // Parse to double
double latPassengerLocation = latlng(passengerLocation, passengerDestination);
double.parse(passengerLocation.toString().split(',')[0]); // double latPassengerLocation =
double lngPassengerLocation = // double.parse(passengerLocation.toString().split(',')[0]);
double.parse(passengerLocation.toString().split(',')[1]); // double lngPassengerLocation =
double latPassengerDestination = // double.parse(passengerLocation.toString().split(',')[1]);
double.parse(passengerDestination.toString().split(',')[0]); // double latPassengerDestination =
double lngPassengerDestination = // double.parse(passengerDestination.toString().split(',')[0]);
double.parse(passengerDestination.toString().split(',')[1]); // double lngPassengerDestination =
latLngPassengerLocation = // double.parse(passengerDestination.toString().split(',')[1]);
LatLng(latPassengerLocation, lngPassengerLocation); // latLngPassengerLocation =
latLngPassengerDestination = // LatLng(latPassengerLocation, lngPassengerLocation);
LatLng(latPassengerDestination, lngPassengerDestination); // latLngPassengerDestination =
// LatLng(latPassengerDestination, lngPassengerDestination);
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';
@@ -913,6 +914,22 @@ class MapDriverController extends GetxController {
update(); update();
} }
latlng(String passengerLocation, passengerDestination) {
double latPassengerLocation =
double.parse(passengerLocation.toString().split(',')[0]);
print('latPassengerLocation $latPassengerLocation');
double lngPassengerLocation =
double.parse(passengerLocation.toString().split(',')[1]);
double latPassengerDestination =
double.parse(passengerDestination.toString().split(',')[0]);
double lngPassengerDestination =
double.parse(passengerDestination.toString().split(',')[1]);
latLngPassengerLocation =
LatLng(latPassengerLocation, lngPassengerLocation);
latLngPassengerDestination =
LatLng(latPassengerDestination, lngPassengerDestination);
}
late Duration durationToAdd; late Duration durationToAdd;
int hours = 0; int hours = 0;
int minutes = 0; int minutes = 0;

View File

@@ -109,56 +109,50 @@ class SpeedMapController extends GetxController {
} }
argumentLoading() async { argumentLoading() async {
passengerLocation = Get.arguments['passengerLocation']; passengerLocation = box.read(BoxName.rideArguments)['passengerLocation'];
print(passengerLocation); print(passengerLocation);
passengerDestination = Get.arguments['passengerDestination']; passengerDestination =
box.read(BoxName.rideArguments)['passengerDestination'];
print(passengerDestination); print(passengerDestination);
duration = Get.arguments['Duration']; duration = box.read(BoxName.rideArguments)['Duration'];
totalCost = Get.arguments['totalCost']; totalCost = box.read(BoxName.rideArguments)['totalCost'];
passengerId = Get.arguments['passengerId']; passengerId = box.read(BoxName.rideArguments)['passengerId'];
driverId = Get.arguments['driverId']; driverId = box.read(BoxName.rideArguments)['driverId'];
distance = Get.arguments['Distance']; distance = box.read(BoxName.rideArguments)['Distance'];
passengerName = Get.arguments['name']; passengerName = box.read(BoxName.rideArguments)['name'];
passengerEmail = Get.arguments['email']; passengerEmail = box.read(BoxName.rideArguments)['email'];
totalPassenger = Get.arguments['totalPassenger']; totalPassenger = box.read(BoxName.rideArguments)['totalPassenger'];
passengerPhone = Get.arguments['phone']; passengerPhone = box.read(BoxName.rideArguments)['phone'];
walletChecked = Get.arguments['WalletChecked']; walletChecked = box.read(BoxName.rideArguments)['WalletChecked'];
tokenPassenger = Get.arguments['tokenPassenger']; tokenPassenger = box.read(BoxName.rideArguments)['tokenPassenger'];
direction = Get.arguments['direction']; direction = box.read(BoxName.rideArguments)['direction'];
durationToPassenger = Get.arguments['DurationToPassenger']; durationToPassenger =
rideId = Get.arguments['rideId']; box.read(BoxName.rideArguments)['DurationToPassenger'].toString();
durationOfRideValue = Get.arguments['durationOfRideValue']; print(durationToPassenger);
paymentAmount = Get.arguments['paymentAmount']; rideId = box.read(BoxName.rideArguments)['rideId'];
paymentMethod = Get.arguments['paymentMethod']; durationOfRideValue =
isHaveSteps = Get.arguments['isHaveSteps']; box.read(BoxName.rideArguments)['durationOfRideValue'];
step0 = Get.arguments['step0']; paymentAmount = box.read(BoxName.rideArguments)['paymentAmount'];
step1 = Get.arguments['step1']; paymentMethod = box.read(BoxName.rideArguments)['paymentMethod'];
step2 = Get.arguments['step2']; isHaveSteps = box.read(BoxName.rideArguments)['isHaveSteps'];
step3 = Get.arguments['step3']; step0 = box.read(BoxName.rideArguments)['step0'];
step4 = Get.arguments['step4']; step1 = box.read(BoxName.rideArguments)['step1'];
passengerWalletBurc = Get.arguments['passengerWalletBurc']; step2 = box.read(BoxName.rideArguments)['step2'];
timeOfOrder = Get.arguments['timeOfOrder']; step3 = box.read(BoxName.rideArguments)['step3'];
carType = Get.arguments['carType']; step4 = box.read(BoxName.rideArguments)['step4'];
kazan = Get.arguments['kazan']; passengerWalletBurc =
startNameLocation = Get.arguments['startNameLocation']; box.read(BoxName.rideArguments)['passengerWalletBurc'];
endNameLocation = Get.arguments['endNameLocation']; timeOfOrder = box.read(BoxName.rideArguments)['timeOfOrder'];
carType = box.read(BoxName.rideArguments)['carType'];
kazan = box.read(BoxName.rideArguments)['kazan'];
startNameLocation = box.read(BoxName.rideArguments)['startNameLocation'];
endNameLocation = box.read(BoxName.rideArguments)['endNameLocation'];
// var coords = passengerLocation.toString().split(','); // var coords = passengerLocation.toString().split(',');
// var coordDestination = passengerDestination.toString().split(','); // var coordDestination = passengerDestination.toString().split(',');
// Parse to double // Parse to double
double latPassengerLocation = latlng(passengerLocation, passengerDestination);
double.parse(passengerLocation.toString().split(',')[0]);
double lngPassengerLocation =
double.parse(passengerLocation.toString().split(',')[1]);
double latPassengerDestination =
double.parse(passengerDestination.toString().split(',')[0]);
double lngPassengerDestination =
double.parse(passengerDestination.toString().split(',')[1]);
latLngPassengerLocation =
LatLng(latPassengerLocation, lngPassengerLocation);
latLngPassengerDestination =
LatLng(latPassengerDestination, lngPassengerDestination);
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';
@@ -178,6 +172,22 @@ class SpeedMapController extends GetxController {
update(); update();
} }
latlng(String passengerLocation, passengerDestination) {
double latPassengerLocation =
double.parse(passengerLocation.toString().split(',')[0]);
print('latPassengerLocation $latPassengerLocation');
double lngPassengerLocation =
double.parse(passengerLocation.toString().split(',')[1]);
double latPassengerDestination =
double.parse(passengerDestination.toString().split(',')[0]);
double lngPassengerDestination =
double.parse(passengerDestination.toString().split(',')[1]);
latLngPassengerLocation =
LatLng(latPassengerLocation, lngPassengerLocation);
latLngPassengerDestination =
LatLng(latPassengerDestination, lngPassengerDestination);
}
double distanceBetweenDriverAndPassengerWhenConfirm = 0; double distanceBetweenDriverAndPassengerWhenConfirm = 0;
getMap(String origin, destination) async { getMap(String origin, destination) async {
isLoading = false; isLoading = false;

View File

@@ -1,5 +1,7 @@
import 'package:SEFER/constant/box_name.dart'; import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/main.dart'; import 'package:SEFER/main.dart';
import 'package:SEFER/views/home/Captin/driver_map_page.dart';
import 'package:SEFER/views/home/Captin/driver_map_speed.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_font_icons/flutter_font_icons.dart'; import 'package:flutter_font_icons/flutter_font_icons.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@@ -21,7 +23,7 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
// duration: const Duration(microseconds: 200), // duration: const Duration(microseconds: 200),
// width: controller.widthMapTypeAndTraffic, // width: controller.widthMapTypeAndTraffic,
// decoration: BoxDecoration( // decoration: BoxDecoration(
// border: Border.all(color: AppColor.accentColor), // border: Border.all(color: AppColor.blueColor),
// color: AppColor.secondaryColor, // color: AppColor.secondaryColor,
// borderRadius: BorderRadius.circular(15)), // borderRadius: BorderRadius.circular(15)),
// child: IconButton( // child: IconButton(
@@ -54,7 +56,7 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
duration: const Duration(microseconds: 200), duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTraffic, width: controller.widthMapTypeAndTraffic,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: AppColor.accentColor), border: Border.all(color: AppColor.blueColor),
color: AppColor.secondaryColor, color: AppColor.secondaryColor,
borderRadius: BorderRadius.circular(15)), borderRadius: BorderRadius.circular(15)),
child: IconButton( child: IconButton(
@@ -65,7 +67,7 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
icon: const Icon( icon: const Icon(
Icons.satellite_alt, Icons.satellite_alt,
size: 29, size: 29,
color: AppColor.accentColor, color: AppColor.blueColor,
), ),
), ),
), ),
@@ -77,7 +79,7 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
width: controller.widthMapTypeAndTraffic, width: controller.widthMapTypeAndTraffic,
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColor.secondaryColor, color: AppColor.secondaryColor,
border: Border.all(color: AppColor.accentColor), border: Border.all(color: AppColor.blueColor),
borderRadius: BorderRadius.circular(15)), borderRadius: BorderRadius.circular(15)),
child: IconButton( child: IconButton(
onPressed: () { onPressed: () {
@@ -87,7 +89,7 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
icon: const Icon( icon: const Icon(
Icons.streetview_sharp, Icons.streetview_sharp,
size: 29, size: 29,
color: AppColor.accentColor, color: AppColor.blueColor,
), ),
), ),
), ),
@@ -99,7 +101,7 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
width: controller.widthMapTypeAndTraffic, width: controller.widthMapTypeAndTraffic,
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColor.secondaryColor, color: AppColor.secondaryColor,
border: Border.all(color: AppColor.accentColor), border: Border.all(color: AppColor.blueColor),
borderRadius: BorderRadius.circular(15)), borderRadius: BorderRadius.circular(15)),
child: IconButton( child: IconButton(
onPressed: () { onPressed: () {
@@ -112,7 +114,7 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
icon: const Icon( icon: const Icon(
Icons.location_on, Icons.location_on,
size: 29, size: 29,
color: AppColor.accentColor, color: AppColor.blueColor,
), ),
), ),
), ),
@@ -124,7 +126,7 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
width: controller.widthMapTypeAndTraffic, width: controller.widthMapTypeAndTraffic,
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColor.secondaryColor, color: AppColor.secondaryColor,
border: Border.all(color: AppColor.accentColor), border: Border.all(color: AppColor.blueColor),
borderRadius: BorderRadius.circular(15)), borderRadius: BorderRadius.circular(15)),
child: IconButton( child: IconButton(
onPressed: () { onPressed: () {
@@ -151,7 +153,28 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
icon: const Icon( icon: const Icon(
FontAwesome5.chart_bar, FontAwesome5.chart_bar,
size: 29, size: 29,
color: AppColor.accentColor, color: AppColor.blueColor,
),
),
),
AnimatedContainer(
duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTraffic,
decoration: BoxDecoration(
color: AppColor.secondaryColor,
border: Border.all(color: AppColor.blueColor),
borderRadius: BorderRadius.circular(15)),
child: IconButton(
onPressed: () {
// Get.to(() => PassengerLocationMapPage(),
// arguments: box.read(BoxName.rideArguments));
Get.to(() => DriverSpeedLocationMapPage());
// print(box.read(BoxName.rideArguments)['Duration']);
},
icon: const Icon(
FontAwesome5.grin_tears,
size: 29,
color: AppColor.blueColor,
), ),
), ),
), ),

View File

@@ -362,74 +362,111 @@ class OrderSpeedRequest extends StatelessWidget {
); );
Get.back(); Get.back();
print( // print(
'Arguments passed to PassengerLocationMapPage:'); // 'Arguments passed to PassengerLocationMapPage:');
print('Passenger Location: ${myList[0]}'); // print('Passenger Location: ${myList[0]}');
print('Passenger Destination: ${myList[1]}'); // print('Passenger Destination: ${myList[1]}');
print('Duration: ${myList[4]}'); // print('Duration: ${myList[4]}');
print('Total Cost: ${myList[26]}'); // print('Total Cost: ${myList[26]}');
print('Distance: ${myList[5]}'); // print('Distance: ${myList[5]}');
print('Name: ${myList[8]}'); // print('Name: ${myList[8]}');
print('Phone: ${myList[10]}'); // print('Phone: ${myList[10]}');
print('Email: ${myList[28]}'); // print('Email: ${myList[28]}');
print('Wallet Checked: ${myList[13]}'); // print('Wallet Checked: ${myList[13]}');
print('Token Passenger: ${myList[9]}'); // print('Token Passenger: ${myList[9]}');
print('Direction: ${myList[29]}'); // print('Direction: ${myList[29]}');
print('Duration To Passenger: ${myList[15]}'); // print('Duration To Passenger: ${myList[15]}');
print('Ride ID: ${myList[16]}'); // print('Ride ID: ${myList[16]}');
print('Passenger ID: ${myList[7]}'); // print('Passenger ID: ${myList[7]}');
print('Driver ID: ${myList[18]}'); // print('Driver ID: ${myList[18]}');
print('Duration Of Ride Value: ${myList[19]}'); // print('Duration Of Ride Value: ${myList[19]}');
print('Payment Amount: ${myList[2]}'); // print('Payment Amount: ${myList[2]}');
print( // print(
'Payment Method: ${myList[13] == 'true' ? 'visa' : 'cash'}'); // 'Payment Method: ${myList[13] == 'true' ? 'visa' : 'cash'}');
print('Is Have Steps: ${myList[20]}'); // print('Is Have Steps: ${myList[20]}');
print('Step 0: ${myList[21]}'); // print('Step 0: ${myList[21]}');
print('Step 1: ${myList[22]}'); // print('Step 1: ${myList[22]}');
print('Step 2: ${myList[23]}'); // print('Step 2: ${myList[23]}');
print('Step 3: ${myList[24]}'); // print('Step 3: ${myList[24]}');
print('Step 4: ${myList[25]}'); // print('Step 4: ${myList[25]}');
print('Passenger Wallet Burc: ${myList[26]}'); // print('Passenger Wallet Burc: ${myList[26]}');
print('Time Of Order: ${myList[30]}'); // print('Time Of Order: ${myList[30]}');
print('Total Passenger: ${myList[2]}'); // print('Total Passenger: ${myList[2]}');
print('Car Type: ${myList[31]}'); // print('Car Type: ${myList[31]}');
print('Kazan: ${myList[32]}'); // print('Kazan: ${myList[32]}');
box.write(BoxName.rideArguments, {
Get.to(() => DriverSpeedLocationMapPage(), 'passengerLocation': myList[0].toString(),
arguments: { 'passengerDestination': myList[1].toString(),
'passengerLocation': myList[0].toString(), 'Duration': myList[4].toString(),
'passengerDestination': myList[1].toString(), 'totalCost': myList[26].toString(),
'Duration': myList[4].toString(), 'Distance': myList[5].toString(),
'totalCost': myList[26].toString(), 'name': myList[8].toString(),
'Distance': myList[5].toString(), 'phone': myList[10].toString(),
'name': myList[8].toString(), 'email': myList[28].toString(),
'phone': myList[10].toString(), 'WalletChecked': myList[13].toString(),
'email': myList[28].toString(), 'tokenPassenger': myList[9].toString(),
'WalletChecked': myList[13].toString(), 'direction':
'tokenPassenger': myList[9].toString(), 'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/',
'direction': 'DurationToPassenger': myList[15].toString(),
'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/', 'rideId': myList[16].toString(),
'DurationToPassenger': myList[15].toString(), 'passengerId': myList[7].toString(),
'rideId': myList[16].toString(), 'driverId': myList[18].toString(),
'passengerId': myList[7].toString(), 'durationOfRideValue': myList[19].toString(),
'driverId': myList[18].toString(), 'paymentAmount': myList[2].toString(),
'durationOfRideValue': myList[19].toString(), 'paymentMethod': myList[13].toString() == 'true'
'paymentAmount': myList[2].toString(), ? 'visa'
'paymentMethod': myList[13].toString() == 'true' : 'cash',
? 'visa' 'isHaveSteps': myList[20].toString(),
: 'cash', 'step0': myList[21].toString(),
'isHaveSteps': myList[20].toString(), 'step1': myList[22].toString(),
'step0': myList[21].toString(), 'step2': myList[23].toString(),
'step1': myList[22].toString(), 'step3': myList[24].toString(),
'step2': myList[23].toString(), 'step4': myList[25].toString(),
'step3': myList[24].toString(), 'passengerWalletBurc': myList[26].toString(),
'step4': myList[25].toString(), 'timeOfOrder': DateTime.now().toString(),
'passengerWalletBurc': myList[26].toString(), 'totalPassenger': myList[2].toString(),
'timeOfOrder': DateTime.now().toString(), 'carType': myList[31].toString(),
'totalPassenger': myList[2].toString(), 'kazan': myList[32].toString(),
'carType': myList[31].toString(), 'startNameLocation': myList[29].toString(),
'kazan': myList[32].toString(), 'endNameLocation': myList[30].toString(),
}); });
Get.to(() => PassengerLocationMapPage(),
arguments: box.read(BoxName.rideArguments)
// {
// 'passengerLocation': myList[0].toString(),
// 'passengerDestination': myList[1].toString(),
// 'Duration': myList[4].toString(),
// 'totalCost': myList[26].toString(),
// 'Distance': myList[5].toString(),
// 'name': myList[8].toString(),
// 'phone': myList[10].toString(),
// 'email': myList[28].toString(),
// 'WalletChecked': myList[13].toString(),
// 'tokenPassenger': myList[9].toString(),
// 'direction':
// 'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/',
// 'DurationToPassenger': myList[15].toString(),
// 'rideId': myList[16].toString(),
// 'passengerId': myList[7].toString(),
// 'driverId': myList[18].toString(),
// 'durationOfRideValue': myList[19].toString(),
// 'paymentAmount': myList[2].toString(),
// 'paymentMethod': 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(),
// 'passengerWalletBurc': myList[26].toString(),
// 'timeOfOrder': DateTime.now().toString(),
// 'totalPassenger': myList[2].toString(),
// 'carType': myList[31].toString(),
// 'kazan': myList[32].toString(),
// }
);
} }
// }); // });
// Get.back(); // Get.back();