2-10/3/1
This commit is contained in:
@@ -21,14 +21,14 @@ GetBuilder<MapDriverController> driverEndRideBar() {
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
height: mapDriverController.remainingTimeTimerRideBegin < 60
|
||||
? mapDriverController.driverEndPage = 190
|
||||
: mapDriverController.carType == 'Mashwari'
|
||||
: mapDriverController.carType == 'Mishwar Vip'
|
||||
? 120
|
||||
: 170,
|
||||
// width: 240,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
mapDriverController.carType != 'Mashwari'
|
||||
mapDriverController.carType != 'Mishwar Vip'
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
@@ -63,8 +63,8 @@ GetBuilder<MapDriverController> driverEndRideBar() {
|
||||
)
|
||||
: const SizedBox(),
|
||||
mapDriverController.carType != 'Speed' &&
|
||||
mapDriverController.carType != 'Delivery' &&
|
||||
mapDriverController.carType != 'Balash'
|
||||
mapDriverController.carType != 'Awfar Car' &&
|
||||
mapDriverController.carType != 'Scooter'
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
@@ -168,7 +168,7 @@ GetBuilder<MapDriverController> driverEndRideBar() {
|
||||
],
|
||||
),
|
||||
mapDriverController.carType != 'Comfort' &&
|
||||
mapDriverController.carType != 'Mashwari' &&
|
||||
mapDriverController.carType != 'Mishwar Vip' &&
|
||||
mapDriverController.carType != 'Lady'
|
||||
? Stack(
|
||||
children: [
|
||||
|
||||
@@ -20,76 +20,88 @@ class GoogleDriverMap extends StatelessWidget {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: GetBuilder<MapDriverController>(
|
||||
builder: (controller) => GoogleMap(
|
||||
onMapCreated: controller.onMapCreated,
|
||||
initialCameraPosition: CameraPosition(
|
||||
// bearing: 45,
|
||||
target: locationController.myLocation,
|
||||
zoom: 16,
|
||||
tilt: 40,
|
||||
),
|
||||
onCameraMoveStarted: () {},
|
||||
onCameraMove: (position) {
|
||||
locationController.myLocation = position.target;
|
||||
controller.mapController!
|
||||
.animateCamera(CameraUpdate.newCameraPosition(position));
|
||||
},
|
||||
minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
|
||||
myLocationEnabled: true,
|
||||
compassEnabled: true,
|
||||
mapType: MapType.normal,
|
||||
trafficEnabled: true,
|
||||
buildingsEnabled: true,
|
||||
mapToolbarEnabled: true,
|
||||
zoomControlsEnabled: true,
|
||||
fortyFiveDegreeImageryEnabled: true,
|
||||
zoomGesturesEnabled: true,
|
||||
polylines: {
|
||||
Polyline(
|
||||
zIndex: 2,
|
||||
consumeTapEvents: true,
|
||||
geodesic: true,
|
||||
endCap: Cap.buttCap,
|
||||
startCap: Cap.buttCap,
|
||||
visible: true,
|
||||
polylineId: const PolylineId('route1'),
|
||||
points: controller.polylineCoordinates,
|
||||
color: AppColor.yellowColor,
|
||||
width: 4,
|
||||
builder: (controller) => Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: Get.height * .6,
|
||||
child: GoogleMap(
|
||||
onMapCreated: controller.onMapCreated,
|
||||
zoomControlsEnabled: true,
|
||||
initialCameraPosition: CameraPosition(
|
||||
// bearing: 45,
|
||||
target: locationController.myLocation,
|
||||
zoom: 13,
|
||||
tilt: 40,
|
||||
),
|
||||
// onCameraMoveStarted: () {},
|
||||
cameraTargetBounds: CameraTargetBounds(controller.boundsData),
|
||||
onCameraMove: (position) {
|
||||
locationController.myLocation = position.target;
|
||||
controller.mapController!
|
||||
.animateCamera(CameraUpdate.newCameraPosition(position));
|
||||
},
|
||||
minMaxZoomPreference: const MinMaxZoomPreference(8, 15),
|
||||
myLocationEnabled: true, myLocationButtonEnabled: true,
|
||||
compassEnabled: true,
|
||||
mapType: MapType.terrain,
|
||||
rotateGesturesEnabled: true,
|
||||
scrollGesturesEnabled: true,
|
||||
trafficEnabled: false,
|
||||
// liteModeEnabled: true,
|
||||
buildingsEnabled: true,
|
||||
mapToolbarEnabled: true,
|
||||
// zoomControlsEnabled: true,
|
||||
fortyFiveDegreeImageryEnabled: true,
|
||||
zoomGesturesEnabled: true,
|
||||
polylines: {
|
||||
Polyline(
|
||||
zIndex: 2,
|
||||
consumeTapEvents: true,
|
||||
geodesic: true,
|
||||
endCap: Cap.buttCap,
|
||||
startCap: Cap.buttCap,
|
||||
visible: true,
|
||||
polylineId: const PolylineId('route1'),
|
||||
points: controller.polylineCoordinates,
|
||||
color: const Color.fromARGB(255, 163, 81, 246),
|
||||
width: 5,
|
||||
),
|
||||
Polyline(
|
||||
zIndex: 2,
|
||||
consumeTapEvents: true,
|
||||
geodesic: true,
|
||||
endCap: Cap.buttCap,
|
||||
startCap: Cap.buttCap,
|
||||
visible: true,
|
||||
polylineId: const PolylineId('route'),
|
||||
points: controller.polylineCoordinatesDestination,
|
||||
color: const Color.fromARGB(255, 10, 29, 126),
|
||||
width: 5,
|
||||
),
|
||||
},
|
||||
markers: {
|
||||
Marker(
|
||||
markerId: MarkerId('MyLocation'.tr),
|
||||
position: locationController.myLocation,
|
||||
draggable: true,
|
||||
icon: controller.carIcon,
|
||||
rotation: locationController.heading),
|
||||
Marker(
|
||||
markerId: MarkerId('start'.tr),
|
||||
position: controller.latLngPassengerLocation,
|
||||
draggable: true,
|
||||
icon: controller.startIcon,
|
||||
),
|
||||
Marker(
|
||||
markerId: MarkerId('end'.tr),
|
||||
position: controller.latLngPassengerDestination,
|
||||
draggable: true,
|
||||
icon: controller.endIcon,
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
Polyline(
|
||||
zIndex: 2,
|
||||
consumeTapEvents: true,
|
||||
geodesic: true,
|
||||
endCap: Cap.buttCap,
|
||||
startCap: Cap.buttCap,
|
||||
visible: true,
|
||||
polylineId: const PolylineId('route'),
|
||||
points: controller.polylineCoordinatesDestination,
|
||||
color: AppColor.primaryColor,
|
||||
width: 4,
|
||||
),
|
||||
},
|
||||
markers: {
|
||||
Marker(
|
||||
markerId: MarkerId('MyLocation'.tr),
|
||||
position: locationController.myLocation,
|
||||
draggable: true,
|
||||
icon: controller.carIcon,
|
||||
rotation: locationController.heading),
|
||||
Marker(
|
||||
markerId: MarkerId('start'.tr),
|
||||
position: controller.latLngPassengerLocation,
|
||||
draggable: true,
|
||||
icon: controller.startIcon,
|
||||
),
|
||||
Marker(
|
||||
markerId: MarkerId('end'.tr),
|
||||
position: controller.latLngPassengerDestination,
|
||||
draggable: true,
|
||||
icon: controller.endIcon,
|
||||
),
|
||||
},
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -29,7 +29,7 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
// left: 8,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
height: Get.height * .35,
|
||||
height: Get.height * .4,
|
||||
width: Get.width,
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
@@ -289,80 +289,137 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
)),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
width: Get.width * .22,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: Text(
|
||||
controller.hours > 1
|
||||
? '⌚️ ${controller.hours}h ${controller.minutes}m' // Ride Duration with emoji
|
||||
: '⌚️ ${controller.minutes}m', // Short ride duration
|
||||
style: AppStyle.number,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10.0), // Add spacing between sections
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
width: Get.width * .22,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Text(
|
||||
' ${controller.distance} km', // Distance with emoji
|
||||
style: AppStyle.number,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 16.0), // Add spacing between sections
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
width: Get.width * .35,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: Text(
|
||||
controller
|
||||
.passengerName, // Passenger name with emoji
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
width: Get.width * .4,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Row(
|
||||
children: [
|
||||
Text("cost is ".tr,
|
||||
style: AppStyle.title),
|
||||
Text(
|
||||
controller.totalPricePassenger
|
||||
.toString(),
|
||||
style: AppStyle.number,
|
||||
// First Row: Trip Info (Duration, Distance, Passenger Name)
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
// Ride Duration
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
width: Get.width * .28,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.timer,
|
||||
color: Colors
|
||||
.grey[700]), // Duration Icon
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
controller.hours > 1
|
||||
? '${controller.hours}h ${controller.minutes}${'m'.tr}'
|
||||
: '${controller.minutes}${'m'.tr}',
|
||||
style: AppStyle.number,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Ride Distance
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
width: Get.width * .28,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.map,
|
||||
color: Colors
|
||||
.grey[700]), // Distance Icon
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
'${controller.distance} km',
|
||||
style: AppStyle.number,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Passenger Name
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
width: Get.width * .38,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.person,
|
||||
color: Colors
|
||||
.grey[700]), // Passenger Icon
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
controller.passengerName,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
width: Get.width * .4,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Text(controller.carType.tr,
|
||||
style: AppStyle.title),
|
||||
),
|
||||
|
||||
const SizedBox(
|
||||
height: 16), // Spacing between rows
|
||||
|
||||
// Second Row: Cost & Car Type
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
// Ride Cost
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
width: Get.width * .45,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.attach_money,
|
||||
color: Colors
|
||||
.grey[700]), // Cost Icon
|
||||
const SizedBox(width: 6),
|
||||
Text("cost is ".tr,
|
||||
style: AppStyle.title),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
controller.totalPricePassenger,
|
||||
style: AppStyle.number,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Car Type
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
width: Get.width * .45,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.directions_car,
|
||||
color:
|
||||
Colors.grey[700]), // Car Icon
|
||||
const SizedBox(width: 6),
|
||||
Text(controller.carType.tr,
|
||||
style: AppStyle.title),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -370,82 +427,94 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
? const SizedBox()
|
||||
: Column(
|
||||
children: [
|
||||
// First Row: Start Ride or Arrive at Location
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
// Start Ride Button
|
||||
MyElevatedButton(
|
||||
title: 'Start the Ride'.tr,
|
||||
kolor: AppColor.greenColor,
|
||||
onPressed: () {
|
||||
Get.defaultDialog(
|
||||
title:
|
||||
'Is the Passenger in your Car ?'
|
||||
.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
middleText:
|
||||
"don't start trip if not"
|
||||
.tr,
|
||||
middleTextStyle:
|
||||
AppStyle.title,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'OK'.tr,
|
||||
kolor:
|
||||
AppColor.greenColor,
|
||||
onPressed: () async {
|
||||
await controller
|
||||
.startRideFromDriver();
|
||||
Get.back();
|
||||
}),
|
||||
cancel: MyElevatedButton(
|
||||
title:
|
||||
'No ,still Waiting.'
|
||||
.tr,
|
||||
kolor: AppColor.redColor,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}));
|
||||
}),
|
||||
title: 'Start the Ride'.tr,
|
||||
kolor: AppColor.greenColor,
|
||||
onPressed: () {
|
||||
Get.defaultDialog(
|
||||
title:
|
||||
'Is the Passenger in your Car?'
|
||||
.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
middleText:
|
||||
"Don't start trip if not".tr,
|
||||
middleTextStyle: AppStyle.title,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'OK'.tr,
|
||||
kolor: AppColor.greenColor,
|
||||
onPressed: () async {
|
||||
await controller
|
||||
.startRideFromDriver();
|
||||
Get.back(); // Close dialog after confirmation
|
||||
},
|
||||
),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'No, still Waiting.'.tr,
|
||||
kolor: AppColor.redColor,
|
||||
onPressed: () {
|
||||
Get.back(); // Close dialog without action
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
// Arrive Notification Button
|
||||
controller.isArrivedSend
|
||||
? MyElevatedButton(
|
||||
title: 'I arrive you'.tr,
|
||||
title: 'I Arrive'.tr,
|
||||
kolor: AppColor.yellowColor,
|
||||
onPressed: () async {
|
||||
if (controller
|
||||
if (await controller
|
||||
.calculateDistanceBetweenDriverAndPassengerLocation() <
|
||||
40) {
|
||||
// Notify Passenger
|
||||
FirebaseMessagesController()
|
||||
.sendNotificationToPassengerToken(
|
||||
'Hi ,I Arrive your site',
|
||||
'I Arrive your site'
|
||||
.tr,
|
||||
controller
|
||||
.tokenPassenger,
|
||||
[],
|
||||
'start.wav');
|
||||
'Hi, I Arrive at your site',
|
||||
'I Arrive at your site'
|
||||
.tr,
|
||||
controller.tokenPassenger,
|
||||
[],
|
||||
'start.wav',
|
||||
);
|
||||
controller
|
||||
.startTimerToShowDriverWaitPassengerDuration();
|
||||
controller.isArrivedSend =
|
||||
false;
|
||||
} else {
|
||||
// Show error dialog if the driver is far from passenger
|
||||
Get.defaultDialog(
|
||||
title:
|
||||
'You are not in near to passenger location'
|
||||
.tr,
|
||||
middleText:
|
||||
'please go to picker location exactly'
|
||||
.tr,
|
||||
confirm:
|
||||
MyElevatedButton(
|
||||
title: 'Ok'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}));
|
||||
title:
|
||||
'You are not near the passenger location'
|
||||
.tr,
|
||||
middleText:
|
||||
'Please go to the pickup location exactly'
|
||||
.tr,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
})
|
||||
: const SizedBox()
|
||||
},
|
||||
)
|
||||
: const SizedBox(), // Hide if already sent
|
||||
],
|
||||
),
|
||||
|
||||
// const SizedBox(
|
||||
// height: 16), // Space between rows
|
||||
|
||||
// Progress Bar for Waiting Time
|
||||
controller.remainingTimeInPassengerLocatioWait <
|
||||
300 &&
|
||||
controller
|
||||
@@ -474,45 +543,58 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
.stringRemainingTimeWaitingPassenger,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
)
|
||||
: controller.isdriverWaitTimeEnd
|
||||
? MyElevatedButton(
|
||||
title: 'You Can Cancel Trip And get Cost of Trip From'
|
||||
: const SizedBox(),
|
||||
|
||||
const SizedBox(
|
||||
height:
|
||||
16), // Space between progress and next section
|
||||
|
||||
// Cancel Trip and Charge Passenger
|
||||
controller.isdriverWaitTimeEnd
|
||||
? MyElevatedButton(
|
||||
title:
|
||||
'You Can Cancel the Trip and get Cost From '
|
||||
.tr +
|
||||
' ${AppInformation.appName}'
|
||||
.tr,
|
||||
kolor:
|
||||
AppColor.deepPurpleAccent,
|
||||
onPressed: () {
|
||||
Get.defaultDialog(
|
||||
title:
|
||||
'Are you sure to cancel?'
|
||||
.tr,
|
||||
titleStyle:
|
||||
AppStyle.title,
|
||||
middleText: '',
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Yes'.tr,
|
||||
onPressed: () async {
|
||||
FirebaseMessagesController()
|
||||
.sendNotificationToPassengerToken(
|
||||
'Driver Cancel Your Trip',
|
||||
'You will be pay the cost to driver or we will get it from you on next trip'
|
||||
.tr,
|
||||
controller
|
||||
.tokenPassenger,
|
||||
[],
|
||||
'cancel.wav');
|
||||
await controller
|
||||
.addWaitingTimeCostFromPassengerToDriverWallet();
|
||||
controller
|
||||
.isdriverWaitTimeEnd =
|
||||
false;
|
||||
}));
|
||||
})
|
||||
: const SizedBox(),
|
||||
AppInformation.appName.tr,
|
||||
kolor: AppColor.deepPurpleAccent,
|
||||
onPressed: () {
|
||||
Get.defaultDialog(
|
||||
title: 'Are you sure to cancel?'
|
||||
.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
middleText: '',
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Yes'.tr,
|
||||
onPressed: () async {
|
||||
FirebaseMessagesController()
|
||||
.sendNotificationToPassengerToken(
|
||||
'Driver Cancelled Your Trip',
|
||||
'You will need to pay the cost to the driver, or it will be deducted from your next trip'
|
||||
.tr,
|
||||
controller.tokenPassenger,
|
||||
[],
|
||||
'cancel.wav',
|
||||
);
|
||||
await controller
|
||||
.addWaitingTimeCostFromPassengerToDriverWallet();
|
||||
controller
|
||||
.isdriverWaitTimeEnd =
|
||||
false;
|
||||
},
|
||||
),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'No'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
: const SizedBox(),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user