24-12/26/1
This commit is contained in:
@@ -15,296 +15,252 @@ import '../../../controller/functions/toast.dart';
|
||||
import '../../../controller/home/map_passenger_controller.dart';
|
||||
|
||||
class RideBeginPassenger extends StatelessWidget {
|
||||
const RideBeginPassenger({
|
||||
super.key,
|
||||
});
|
||||
const RideBeginPassenger({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProfileController profileController = Get.put(ProfileController());
|
||||
AudioRecorderController audioController =
|
||||
Get.put(AudioRecorderController());
|
||||
// Get.put(MapPassengerController());
|
||||
|
||||
return GetBuilder<MapPassengerController>(builder: (controller) {
|
||||
if (controller.statusRide == 'Begin' || !controller.statusRideFromStart) {
|
||||
if (controller.statusRide == 'Begin') {
|
||||
return Positioned(
|
||||
left: 10,
|
||||
right: 10,
|
||||
bottom: 10,
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
height: controller.statusRide == 'Begin' ? Get.height * .33 : 0,
|
||||
// width: 100,
|
||||
child: Card(
|
||||
// Wrapped in a Card
|
||||
elevation: 5,
|
||||
shape:
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
mainAxisSize: MainAxisSize.min, // Use minimum space
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 30,
|
||||
backgroundImage: NetworkImage(
|
||||
'${AppLink.server}/portrate_captain_image/${controller.driverId}.jpg'),
|
||||
'${AppLink.server}/portrate_captain_image/${controller.driverId}.jpg',
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: Text(
|
||||
controller.driverName,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(controller.driverName, style: AppStyle.title),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
controller.make,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
controller.model,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(controller.make, style: AppStyle.subtitle),
|
||||
const SizedBox(width: 5),
|
||||
Text(controller.model,
|
||||
style: AppStyle.subtitle),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: <Widget>[
|
||||
const Text(''),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text(
|
||||
controller.licensePlate,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(3),
|
||||
child: Text(
|
||||
'${box.read(BoxName.carType)}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
controller.licensePlate,
|
||||
style: AppStyle.title.copyWith(fontSize: 16),
|
||||
),
|
||||
Text(
|
||||
'${controller.driverRate} 📈',
|
||||
style: AppStyle.title,
|
||||
'${box.read(BoxName.carType)}',
|
||||
style: AppStyle.title.copyWith(fontSize: 16),
|
||||
),
|
||||
Text(
|
||||
'${controller.driverRate} ⭐️',
|
||||
style: AppStyle.title
|
||||
.copyWith(color: AppColor.greenColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 5,
|
||||
// ),
|
||||
const SizedBox(height: 15),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
controller.getDialog('Arrival time'.tr,
|
||||
'arrival time to reach your point'.tr, () {});
|
||||
},
|
||||
child: Container(
|
||||
width: Get.width * .15,
|
||||
decoration: AppStyle.boxDecoration,
|
||||
SizedBox(
|
||||
width: Get.width * 0.18,
|
||||
child: InkWell(
|
||||
onTap: () => controller.getDialog(
|
||||
'Arrival time'.tr,
|
||||
'arrival time to reach your point'.tr,
|
||||
() {},
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'⏱️',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
controller.arrivalTime,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
const Icon(Icons.timer_outlined, size: 28),
|
||||
Text(controller.arrivalTime,
|
||||
style: AppStyle.title),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
controller.getDialog(
|
||||
'Price of trip'.tr,
|
||||
'For Speed and Delivery trips, the price is calculated dynamically. For Comfort trips, the price is based on time and distance'
|
||||
.tr, () {
|
||||
Get.back();
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
width: Get.width * .15,
|
||||
decoration: AppStyle.boxDecoration,
|
||||
SizedBox(
|
||||
width: Get.width * 0.18,
|
||||
child: InkWell(
|
||||
onTap: () => controller.getDialog(
|
||||
'Price of trip'.tr,
|
||||
'For Speed and Delivery trips, the price is calculated dynamically. For Comfort trips, the price is based on time and distance'
|
||||
.tr,
|
||||
() => Get.back(),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const Icon(Icons.monetization_on, size: 28),
|
||||
Text(
|
||||
'💵 ',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
controller.totalPassenger.toStringAsFixed(2),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
'${controller.totalPassenger.toStringAsFixed(2)}',
|
||||
style: AppStyle.title),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: Get.width * .15,
|
||||
decoration: AppStyle.boxDecoration,
|
||||
SizedBox(
|
||||
width: Get.width * 0.18,
|
||||
child: IconButton(
|
||||
onPressed: () => Get.to(
|
||||
() => ComplaintPage(),
|
||||
transition: Transition.downToUp,
|
||||
),
|
||||
icon: const Icon(
|
||||
Icons.note_add,
|
||||
color: AppColor.redColor,
|
||||
),
|
||||
tooltip: ' Add Note', // Optional tooltip for clarity
|
||||
onPressed: () => Get.to(() => ComplaintPage(),
|
||||
transition: Transition.downToUp),
|
||||
icon: const Icon(Icons.note_add,
|
||||
color: AppColor.redColor),
|
||||
tooltip: 'Add Note',
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: Get.width * .15,
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: audioController.isRecording == false
|
||||
? IconButton(
|
||||
onPressed: () async {
|
||||
await audioController.startRecording();
|
||||
Toast.show(context, 'Start Record'.tr,
|
||||
AppColor.greenColor);
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.play_circle_fill_outlined,
|
||||
color: AppColor.greenColor,
|
||||
),
|
||||
tooltip:
|
||||
' Add Note', // Optional tooltip for clarity
|
||||
)
|
||||
: IconButton(
|
||||
onPressed: () async {
|
||||
await audioController.stopRecording();
|
||||
Toast.show(context, 'Record saved'.tr,
|
||||
AppColor.greenColor);
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.stop_circle,
|
||||
color: AppColor.greenColor,
|
||||
),
|
||||
tooltip:
|
||||
' Add Note', // Optional tooltip for clarity
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * 0.18,
|
||||
child: IconButton(
|
||||
onPressed: () async {
|
||||
if (audioController.isRecording == false) {
|
||||
await audioController.startRecording();
|
||||
Toast.show(context, 'Start Record'.tr,
|
||||
AppColor.greenColor);
|
||||
} else {
|
||||
await audioController.stopRecording();
|
||||
Toast.show(context, 'Record saved'.tr,
|
||||
AppColor.greenColor);
|
||||
}
|
||||
},
|
||||
icon: Icon(
|
||||
audioController.isRecording == false
|
||||
? Icons.mic_none
|
||||
: Icons.mic_off,
|
||||
color: AppColor.greenColor,
|
||||
),
|
||||
tooltip: audioController.isRecording == false
|
||||
? 'Start Recording'
|
||||
: 'Stop Recording',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
// StreamCounter(),
|
||||
LinearProgressIndicator(
|
||||
backgroundColor: AppColor.accentColor,
|
||||
backgroundColor: AppColor.accentColor
|
||||
.withOpacity(0.3), // Added background
|
||||
color: controller.remainingTimeTimerRideBegin < 60
|
||||
? AppColor.redColor
|
||||
: AppColor.greenColor,
|
||||
minHeight: 25,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
minHeight: 20,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
value: controller.progressTimerRideBegin.toDouble(),
|
||||
),
|
||||
Center(
|
||||
child: Text(
|
||||
controller.stringRemainingTimeRideBegin,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
)
|
||||
Text(
|
||||
controller.stringRemainingTimeRideBegin,
|
||||
style: AppStyle.title.copyWith(fontSize: 14),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
width: Get.width * .15,
|
||||
child: IconButton(
|
||||
onPressed: () async {
|
||||
if (box.read(BoxName.sosPhonePassenger) == null) {
|
||||
{
|
||||
await profileController.updatField(
|
||||
'sosPhone', TextInputType.phone);
|
||||
box.write(BoxName.sosPhonePassenger,
|
||||
profileController.prfoileData['sosPhone']);
|
||||
}
|
||||
} else {
|
||||
makePhoneCall('122');
|
||||
// box.read(BoxName.sosPhonePassenger));
|
||||
}
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.sos_rounded,
|
||||
color: AppColor.redColor,
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * 0.18,
|
||||
child: Column(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
if (box.read(BoxName.sosPhonePassenger) ==
|
||||
null) {
|
||||
await profileController.updatField(
|
||||
'sosPhone', TextInputType.phone);
|
||||
box.write(
|
||||
BoxName.sosPhonePassenger,
|
||||
profileController
|
||||
.prfoileData['sosPhone']);
|
||||
} else {
|
||||
makePhoneCall('122');
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.sos_rounded,
|
||||
color: AppColor.redColor),
|
||||
),
|
||||
Text('SOS', style: AppStyle.title),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
width: Get.width * .15,
|
||||
child: IconButton(
|
||||
onPressed: () async {
|
||||
if (box.read(BoxName.sosPhonePassenger) == null ||
|
||||
box.read(BoxName.sosPhonePassenger) == 'sos') {
|
||||
{
|
||||
await profileController.updatField(
|
||||
'sosPhone', TextInputType.phone);
|
||||
box.write(BoxName.sosPhonePassenger,
|
||||
profileController.prfoileData['sosPhone']);
|
||||
}
|
||||
} else {
|
||||
String phoneNumber = box
|
||||
.read(BoxName.sosPhonePassenger)
|
||||
.toString();
|
||||
// phoneNumber = phoneNumber.replaceAll('0', '');
|
||||
var phone = box.read(BoxName.countryCode) ==
|
||||
'Egypt'
|
||||
? '+2${box.read(BoxName.sosPhonePassenger)}'
|
||||
: '+962${box.read(BoxName.sosPhonePassenger)}';
|
||||
controller.sendWhatsapp(phone);
|
||||
}
|
||||
},
|
||||
icon: const Icon(
|
||||
FontAwesome.whatsapp,
|
||||
color: AppColor.greenColor,
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * 0.18,
|
||||
child: Column(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
if (box.read(BoxName.sosPhonePassenger) ==
|
||||
null ||
|
||||
box.read(BoxName.sosPhonePassenger) ==
|
||||
'sos') {
|
||||
await profileController.updatField(
|
||||
'sosPhone', TextInputType.phone);
|
||||
box.write(
|
||||
BoxName.sosPhonePassenger,
|
||||
profileController
|
||||
.prfoileData['sosPhone']);
|
||||
} else {
|
||||
final phoneNumber = box
|
||||
.read(BoxName.sosPhonePassenger)
|
||||
.toString();
|
||||
final phone =
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? '+2$phoneNumber'
|
||||
: '+962$phoneNumber';
|
||||
controller.sendWhatsapp(phone);
|
||||
}
|
||||
},
|
||||
icon: const Icon(FontAwesome.whatsapp,
|
||||
color: AppColor.greenColor),
|
||||
),
|
||||
Text('WhatsApp', style: AppStyle.title),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
width: Get.width * .15,
|
||||
child: IconButton(
|
||||
onPressed: () async {
|
||||
await controller.getTokenForParent();
|
||||
},
|
||||
icon: const Icon(
|
||||
Foundation.video,
|
||||
color: AppColor.blueColor,
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * 0.18,
|
||||
child: Column(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
await controller.getTokenForParent();
|
||||
},
|
||||
icon: const Icon(Foundation.video,
|
||||
color: AppColor.blueColor),
|
||||
),
|
||||
Text('Video Call', style: AppStyle.title),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -317,6 +273,7 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
// Removed the StreamCounter widget as it's not directly part of the RideBeginPassenger UI.
|
||||
class StreamCounter extends StatelessWidget {
|
||||
const StreamCounter({Key? key}) : super(key: key);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user