This commit is contained in:
Hamza-Ayed
2024-07-05 04:50:32 +03:00
parent b5bc36e4be
commit dc4677a6bf
21 changed files with 586 additions and 234 deletions

View File

@@ -1,4 +1,5 @@
import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
import 'package:SEFER/views/widgets/mydialoug.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/box_name.dart';
@@ -33,8 +34,6 @@ class OrderRequestPage extends StatelessWidget {
orderRequestController.startTimer(myList[6].toString(), body.toString());
var coords = myList[0].split(',');
var coordDestination = myList[1].split(',');
BitmapDescriptor startIcon = BitmapDescriptor.defaultMarker;
BitmapDescriptor endIcon = BitmapDescriptor.defaultMarker;
// Parse to double
double latPassengerLocation = double.parse(coords[0]);
@@ -64,20 +63,6 @@ class OrderRequestPage extends StatelessWidget {
// Create the marker with the resized image
orderRequestController.calculateConsumptionFuel();
ImageConfiguration config = ImageConfiguration(
size: const Size(25, 25), devicePixelRatio: Get.pixelRatio);
BitmapDescriptor.fromAssetImage(config, 'assets/images/A.png',
mipmaps: false)
.then((value) {
startIcon = value;
});
ImageConfiguration config1 = ImageConfiguration(
size: const Size(25, 25), devicePixelRatio: Get.pixelRatio);
BitmapDescriptor.fromAssetImage(config1, 'assets/images/b.png',
mipmaps: false)
.then((value) {
endIcon = value;
});
// }
// orderRequestController.calculateConsumptionFuel();
@@ -92,7 +77,7 @@ class OrderRequestPage extends StatelessWidget {
// SizedBox(height: 200, child: Text(pointsList.toString())),
// Text(message.notification!.body.toString()),
SizedBox(
height: Get.height * .3,
height: Get.height * .33,
child: GoogleMap(
initialCameraPosition: CameraPosition(
zoom: 12,
@@ -109,13 +94,13 @@ class OrderRequestPage extends StatelessWidget {
position: LatLng(
latPassengerLocation, lngPassengerLocation),
draggable: true,
icon: startIcon),
icon: orderRequestController.startIcon),
Marker(
markerId: MarkerId('Destination'.tr),
position: LatLng(
latPassengerDestination, lngPassengerDestination),
draggable: true,
icon: endIcon),
icon: orderRequestController.endIcon),
},
polylines: {
Polyline(
@@ -155,7 +140,7 @@ class OrderRequestPage extends StatelessWidget {
'Trip has Steps'.tr,
style: AppStyle.title,
)
: Text('Rouats of Trip'.tr,
: Text('Routs of Trip'.tr,
style: AppStyle.title)),
Container(
color: myList[13].toString() == 'true'
@@ -209,12 +194,12 @@ class OrderRequestPage extends StatelessWidget {
)),
),
Container(
height: Get.height * .2,
height: Get.height * .15,
width: Get.width * .9,
decoration: AppStyle.boxDecoration1,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
child: ListView(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
children: [
@@ -287,7 +272,7 @@ class OrderRequestPage extends StatelessWidget {
Padding(
padding: const EdgeInsets.all(4),
child: Container(
color: AppColor.deepPurpleAccent,
color: AppColor.greenColor.withOpacity(.5),
child: RichText(
text: TextSpan(
text: 'Cost Of Trip IS '.tr,
@@ -321,68 +306,78 @@ class OrderRequestPage extends StatelessWidget {
'order_id': body.toString(),
'status': 'Apply'
});
await CRUD()
.post(link: AppLink.updateRides, payload: {
'id': myList[16],
'rideTimeStart': DateTime.now().toString(),
'status': 'Apply',
'driver_id': box.read(BoxName.driverID),
});
var res = await CRUD().post(
link: AppLink.updateRideAndCheckIfApplied,
payload: {
'id': myList[16],
'rideTimeStart': DateTime.now().toString(),
'status': 'Apply',
'driver_id': box.read(BoxName.driverID),
});
if (res == 'failure') {
MyDialog().getDialog(
"This ride is already applied by another driver."
.tr,
'', () {
Get.back();
});
} else {
List<String> bodyToPassenger = [
box.read(BoxName.driverID).toString(),
box.read(BoxName.nameDriver).toString(),
box.read(BoxName.tokenDriver).toString(),
];
FirebaseMessagesController()
.sendNotificationToPassengerToken(
'Apply Ride',
'your ride is applied'.tr,
// arguments['DriverList'][9].toString(),
arguments['DriverList'][9].toString(),
// box.read(BoxName.tokenDriver).toString(),
bodyToPassenger,
'start.wav');
Get.back();
box.write(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(),
'startNameLocation': myList[29].toString(),
'endNameLocation': myList[30].toString(),
});
'passengerID =${box.read(BoxName.rideArguments)}';
Get.to(() => PassengerLocationMapPage(),
arguments: box.read(BoxName.rideArguments));
}
// Get.back();
List<String> bodyToPassenger = [
box.read(BoxName.driverID).toString(),
box.read(BoxName.nameDriver).toString(),
box.read(BoxName.tokenDriver).toString(),
];
FirebaseMessagesController()
.sendNotificationToPassengerToken(
'Apply Ride',
'your ride is applied'.tr,
// arguments['DriverList'][9].toString(),
arguments['DriverList'][9].toString(),
// box.read(BoxName.tokenDriver).toString(),
bodyToPassenger,
'start.wav');
Get.back();
box.write(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(),
'startNameLocation': myList[29].toString(),
'endNameLocation': myList[30].toString(),
});
'passengerID =${box.read(BoxName.rideArguments)}';
Get.to(() => PassengerLocationMapPage(),
arguments: box.read(BoxName.rideArguments));
},
),
GetBuilder<OrderRequestController>(
@@ -451,6 +446,6 @@ class OrderRequestPage extends StatelessWidget {
),
)
],
isleading: true);
isleading: false);
}
}

View File

@@ -37,8 +37,6 @@ class OrderSpeedRequest extends StatelessWidget {
myList[6].toString(), body.toString());
var coords = myList[0].split(',');
var coordDestination = myList[1].split(',');
BitmapDescriptor startIcon = BitmapDescriptor.defaultMarker;
BitmapDescriptor endIcon = BitmapDescriptor.defaultMarker;
// Parse to double
double latPassengerLocation = double.parse(coords[0]);
@@ -68,20 +66,6 @@ class OrderSpeedRequest extends StatelessWidget {
// Create the marker with the resized image
orderRequestController.calculateConsumptionFuel();
ImageConfiguration config = ImageConfiguration(
size: const Size(25, 25), devicePixelRatio: Get.pixelRatio);
BitmapDescriptor.fromAssetImage(config, 'assets/images/A.png',
mipmaps: false)
.then((value) {
startIcon = value;
});
ImageConfiguration config1 = ImageConfiguration(
size: const Size(25, 25), devicePixelRatio: Get.pixelRatio);
BitmapDescriptor.fromAssetImage(config1, 'assets/images/b.png',
mipmaps: false)
.then((value) {
endIcon = value;
});
// }
// double mpg = 0;
// calculateConsumptionFuel() {
@@ -98,7 +82,7 @@ class OrderSpeedRequest extends StatelessWidget {
// SizedBox(height: 200, child: Text(pointsList.toString())),
// Text(message.notification!.body.toString()),
SizedBox(
height: Get.height * .2,
height: Get.height * .33,
child: GoogleMap(
initialCameraPosition: CameraPosition(
zoom: 12,
@@ -115,13 +99,13 @@ class OrderSpeedRequest extends StatelessWidget {
position:
LatLng(latPassengerLocation, lngPassengerLocation),
draggable: true,
icon: startIcon),
icon: orderRequestController.startIcon),
Marker(
markerId: MarkerId('Destination'.tr),
position: LatLng(
latPassengerDestination, lngPassengerDestination),
draggable: true,
icon: endIcon),
icon: orderRequestController.endIcon),
},
polylines: {
Polyline(
@@ -161,7 +145,7 @@ class OrderSpeedRequest extends StatelessWidget {
'Trip has Steps'.tr,
style: AppStyle.title,
)
: Text('Rouats of Trip'.tr,
: Text('Routs of Trip'.tr,
style: AppStyle.title)),
Container(
color: myList[13].toString() == 'true'
@@ -191,6 +175,21 @@ class OrderSpeedRequest extends StatelessWidget {
double.parse(myList[2]).toStringAsFixed(2),
style: AppStyle.headTitle2,
),
AnimatedContainer(
duration: const Duration(seconds: 5),
curve: Curves.easeInOut,
child: AnimatedSize(
duration: const Duration(seconds: 5),
curve: Curves.easeInOut,
child: myList[31].toString() == 'Comfort'
? const Icon(
Icons.ac_unit,
color: AppColor.blueColor,
size: 50,
)
: const SizedBox(),
),
),
Text(
myList[31].toString(),
style: AppStyle.title
@@ -200,12 +199,12 @@ class OrderSpeedRequest extends StatelessWidget {
)),
),
Container(
height: Get.height * .2,
height: Get.height * .15,
width: Get.width * .9,
decoration: AppStyle.boxDecoration1,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
child: ListView(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,