2-10/3/1
This commit is contained in:
@@ -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