This commit is contained in:
Hamza-Ayed
2024-10-02 23:47:52 +03:00
parent 6f95dafd0b
commit 79b14ab9cc
9 changed files with 298 additions and 291 deletions

View File

@@ -29,7 +29,7 @@ class PassengerInfoWindow extends StatelessWidget {
// left: 8,
child: AnimatedContainer(
duration: const Duration(milliseconds: 300),
height: Get.height * .4,
height: Get.height * .35,
width: Get.width,
decoration: AppStyle.boxDecoration1,
child: Padding(
@@ -366,191 +366,155 @@ class PassengerInfoWindow extends StatelessWidget {
),
],
),
controller.remainingTimeToPassenger != 0
? Stack(
controller.isRideBegin
? const SizedBox()
: Column(
children: [
LinearProgressIndicator(
backgroundColor: AppColor.accentColor,
color:
controller.remainingTimeToPassenger <
60
? AppColor.redColor
: AppColor.greenColor,
minHeight: 25,
borderRadius: BorderRadius.circular(15),
value: controller.progressToPassenger
.toDouble(),
),
Center(
child: Text(
controller
.stringRemainingTimeToPassenger,
style: AppStyle.title,
),
)
],
)
: controller.isRideBegin
? const SizedBox()
: Column(
Row(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
MyElevatedButton(
title: 'Start the Ride'.tr,
kolor: AppColor.greenColor,
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();
}));
}),
controller.isArrivedSend
? MyElevatedButton(
title: 'I arrive you'.tr,
kolor: AppColor.yellowColor,
onPressed: () async {
if (controller
.calculateDistanceBetweenDriverAndPassengerLocation() <
40) {
FirebaseMessagesController()
.sendNotificationToPassengerToken(
'Hi ,I Arrive your site',
'I Arrive your site'
.tr,
controller
.tokenPassenger,
[],
'start.wav');
controller
.startTimerToShowDriverWaitPassengerDuration();
controller.isArrivedSend =
false;
} else {
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();
}));
}
})
: const SizedBox()
],
),
controller.remainingTimeInPassengerLocatioWait <
300 &&
controller
.remainingTimeInPassengerLocatioWait !=
0
? Stack(
children: [
LinearProgressIndicator(
backgroundColor:
AppColor.greyColor,
color: controller
.remainingTimeInPassengerLocatioWait <
60
? AppColor.redColor
: AppColor.greenColor,
minHeight: 25,
borderRadius:
BorderRadius.circular(15),
value: controller
.progressInPassengerLocationFromDriver
.toDouble(),
),
Center(
child: Text(
controller
.stringRemainingTimeWaitingPassenger,
style: AppStyle.title,
),
)
],
)
: controller.isdriverWaitTimeEnd
? MyElevatedButton(
title: 'You Can Cancel Trip And get Cost of Trip From'
.tr +
' ${AppInformation.appName}'
.tr,
kolor:
AppColor.deepPurpleAccent,
onPressed: () {
Get.defaultDialog(
title:
'Is the Passenger in your Car ?'
'Are you sure to cancel?'
.tr,
titleStyle:
AppStyle.title,
middleText:
"don't start trip if not"
.tr,
middleTextStyle:
AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'OK'.tr,
kolor: AppColor
.greenColor,
title: 'Yes'.tr,
onPressed: () async {
await controller
.startRideFromDriver();
Get.back();
}),
cancel: MyElevatedButton(
title:
'No ,still Waiting.'
.tr,
kolor:
AppColor.redColor,
onPressed: () {
Get.back();
}));
}),
controller.isArrivedSend
? MyElevatedButton(
title: 'I arrive you'.tr,
kolor: AppColor.yellowColor,
onPressed: () async {
// Await the result of the distance calculation
double distanceToArrive =
await controller
.calculateDistanceBetweenDriverAndPassengerLocation();
if (distanceToArrive <
40) {
FirebaseMessagesController()
.sendNotificationToPassengerToken(
'Hi ,I Arrive your site',
'I Arrive your site'
.tr,
controller
.tokenPassenger,
[],
'start.wav');
controller
.startTimerToShowDriverWaitPassengerDuration();
controller
.isArrivedSend =
false;
} else {
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();
}));
}
})
: const SizedBox()
],
),
controller.remainingTimeInPassengerLocatioWait <
300 &&
controller
.remainingTimeInPassengerLocatioWait !=
0
? Stack(
children: [
LinearProgressIndicator(
backgroundColor:
AppColor.greyColor,
color: controller
.remainingTimeInPassengerLocatioWait <
60
? AppColor.redColor
: AppColor.greenColor,
minHeight: 25,
borderRadius:
BorderRadius.circular(
15),
value: controller
.progressInPassengerLocationFromDriver
.toDouble(),
),
Center(
child: Text(
controller
.stringRemainingTimeWaitingPassenger,
style: AppStyle.title,
),
)
],
)
: controller.isdriverWaitTimeEnd
? MyElevatedButton(
title: 'You Can Cancel Trip And get Cost of Trip 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();
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
.isdriverWaitTimeEnd =
false;
}));
})
: const SizedBox(),
],
),
.tokenPassenger,
[],
'cancel.wav');
await controller
.addWaitingTimeCostFromPassengerToDriverWallet();
controller
.isdriverWaitTimeEnd =
false;
}));
})
: const SizedBox(),
],
),
],
),
),