This commit is contained in:
Hamza-Ayed
2024-10-26 16:31:17 +03:00
parent d6200e28e0
commit 229646d664
24 changed files with 1098 additions and 879 deletions

View File

@@ -1,4 +1,8 @@
import 'dart:io';
import 'package:SEFER/views/widgets/my_textField.dart';
import 'package:SEFER/views/widgets/mydialoug.dart';
import 'package:bubble_head/bubble.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_font_icons/flutter_font_icons.dart';
@@ -19,7 +23,7 @@ class PassengerInfoWindow extends StatelessWidget {
@override
Widget build(BuildContext context) {
Get.put(MapDriverController());
// Get.put(MapDriverController());
return GetBuilder<MapDriverController>(
builder: (controller) => controller.isPassengerInfoWindow == true
? Stack(
@@ -275,6 +279,11 @@ class PassengerInfoWindow extends StatelessWidget {
AppStyle.boxDecoration,
child: IconButton(
onPressed: () async {
if (Platform.isAndroid) {
Bubble().startBubbleHead(
sendAppToBackground:
true);
}
await controller
.openGoogleMapFromDriverToPassenger();
},
@@ -437,30 +446,15 @@ class PassengerInfoWindow extends StatelessWidget {
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
},
),
MyDialog().getDialog(
"Is the Passenger in your Car ?"
.tr,
"Don't start trip if not".tr,
() async {
await controller
.startRideFromDriver();
// Close dialog after confirmation
},
);
},
),
@@ -489,21 +483,14 @@ class PassengerInfoWindow extends StatelessWidget {
controller.isArrivedSend =
false;
} else {
MyDialog().getDialog(
'You are not near the passenger location'
.tr,
'Please go to the pickup location exactly'
.tr, () {
Get.back();
});
// Show error dialog if the driver is far from passenger
Get.defaultDialog(
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();
},
),
);
}
},
)
@@ -561,37 +548,24 @@ class PassengerInfoWindow extends StatelessWidget {
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();
},
),
);
MyDialog().getDialog(
'Are you sure to cancel?'.tr,
'', () 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;
Get.back();
});
},
)
: const SizedBox(),
@@ -604,48 +578,6 @@ class PassengerInfoWindow extends StatelessWidget {
),
],
)
// : controller.remainingTimeToShowPassengerInfoWindowFromDriver > 0 //
// ? Positioned(
// bottom: Get.height * .2,
// left: 15,
// child: Container(
// decoration: AppStyle.boxDecoration,
// child: Padding(
// padding: const EdgeInsets.all(8.0),
// child: Row(
// children: [
// Stack(
// alignment: Alignment.center,
// children: [
// const CircularProgressIndicator(
// backgroundColor: AppColor.redColor,
// strokeWidth: 10,
// color: AppColor.redColor,
// value: 1,
// ),
// CircularProgressIndicator(
// value: controller.progress,
// // Set the color based on the "isNearEnd" condition
// color: AppColor.yellowColor,
// ),
// Text(
// '${controller.remainingTimeToShowPassengerInfoWindowFromDriver}',
// style: AppStyle.number,
// ),
// ],
// ),
// const SizedBox(
// width: 10,
// ),
// Text(
// 'Please Wait If passenger want To Cancel!'.tr,
// style: AppStyle.title,
// ),
// ],
// ),
// ),
// ),
// )
: const SizedBox(),
);
}