4/7/7
This commit is contained in:
@@ -578,7 +578,7 @@ class MapPassengerController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
late String arrivalTime;
|
||||
late String arrivalTime = '';
|
||||
void rideIsBeginPassengerTimer() async {
|
||||
// Calculate arrival time considering current time and duration
|
||||
DateTime now = DateTime.now();
|
||||
@@ -707,6 +707,17 @@ class MapPassengerController extends GetxController {
|
||||
if (rideStatusFromStartApp['data']['status'] == 'Begin') {
|
||||
statusRide = 'Begin';
|
||||
statusRideFromStart = true;
|
||||
DateTime endTime =
|
||||
DateTime.parse(rideStatusFromStartApp['data']['endtime']);
|
||||
DateTime rideTimeStart =
|
||||
DateTime.parse(rideStatusFromStartApp['data']['rideTimeStart']);
|
||||
|
||||
// Calculate the new end time by adding the duration to the rideTimeStart
|
||||
DateTime newEndTime = rideTimeStart.add(
|
||||
Duration(seconds: endTime.difference(rideTimeStart).inSeconds));
|
||||
|
||||
// Save the new end time in a variable
|
||||
var newEndTimeVariable = newEndTime.toString();
|
||||
update();
|
||||
|
||||
Map<String, dynamic> tripData =
|
||||
|
||||
@@ -178,22 +178,20 @@ class OrderRequestPage extends StatelessWidget {
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
double.parse(myList[2]).toStringAsFixed(2),
|
||||
style: AppStyle.headTitle2,
|
||||
)
|
||||
// RichText(
|
||||
// text: TextSpan(
|
||||
// text: 'Total From Passenger is '.tr,
|
||||
// style: AppStyle.title,
|
||||
// children: [
|
||||
// TextSpan(
|
||||
// text: double.parse(myList[2]).toStringAsFixed(2),
|
||||
// style: AppStyle.headTitle2),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text(
|
||||
double.parse(myList[2]).toStringAsFixed(2),
|
||||
style: AppStyle.headTitle2,
|
||||
),
|
||||
Text(
|
||||
myList[31].toString(),
|
||||
style: AppStyle.title
|
||||
.copyWith(color: AppColor.deepPurpleAccent),
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
Container(
|
||||
height: Get.height * .15,
|
||||
|
||||
@@ -178,22 +178,20 @@ class OrderSpeedRequest extends StatelessWidget {
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
double.parse(myList[2]).toStringAsFixed(2),
|
||||
style: AppStyle.headTitle2,
|
||||
)
|
||||
// RichText(
|
||||
// text: TextSpan(
|
||||
// text: 'Total From Passenger is '.tr,
|
||||
// style: AppStyle.title,
|
||||
// children: [
|
||||
// TextSpan(
|
||||
// text: double.parse(myList[2]).toStringAsFixed(2),
|
||||
// style: AppStyle.headTitle2),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text(
|
||||
double.parse(myList[2]).toStringAsFixed(2),
|
||||
style: AppStyle.headTitle2,
|
||||
),
|
||||
Text(
|
||||
myList[31].toString(),
|
||||
style: AppStyle.title
|
||||
.copyWith(color: AppColor.deepPurpleAccent),
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
Container(
|
||||
height: Get.height * .15,
|
||||
|
||||
@@ -39,29 +39,35 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
'⏱️ Arrive',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
controller.arrivalTime,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'⏱️',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
controller.arrivalTime,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
' Total',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
controller.totalPassenger.toStringAsFixed(2),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'💵 ',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
controller.totalPassenger.toStringAsFixed(2),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => Get.to(
|
||||
@@ -131,44 +137,6 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
box.write(BoxName.sosPhonePassenger,
|
||||
profileController.prfoileData['sosPhone']);
|
||||
}
|
||||
// Get.defaultDialog(
|
||||
// title: 'You dont Add Emergency Phone Yet!'.tr,
|
||||
// content: Column(
|
||||
// children: [
|
||||
// Form(
|
||||
// key: controller.sosFormKey,
|
||||
// child: TextFormField(
|
||||
// keyboardType: TextInputType
|
||||
// .phone, // Set the keyboard type to phone
|
||||
// controller:
|
||||
// controller.sosPhonePassengerProfile,
|
||||
// validator: (value) {
|
||||
// if (value!.isEmpty ||
|
||||
// value.length != 10) {
|
||||
// return 'Please enter a valid phone number'
|
||||
// .tr;
|
||||
// }
|
||||
// // Add additional validation if needed
|
||||
// return null;
|
||||
// },
|
||||
// decoration: const InputDecoration(
|
||||
// border: OutlineInputBorder(),
|
||||
// hintText: 'Type here',
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// confirm: MyElevatedButton(
|
||||
// title: 'Add Phone'.tr,
|
||||
// onPressed: () async {
|
||||
// await profileController
|
||||
// .updatField('sosPhone');
|
||||
// box.write(
|
||||
// BoxName.sosPhonePassenger,
|
||||
// profileController
|
||||
// .prfoileData['sosPhone']);
|
||||
// }));
|
||||
} else {
|
||||
controller
|
||||
.sendSMS(box.read(BoxName.sosPhonePassenger));
|
||||
@@ -208,34 +176,6 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
)
|
||||
// controller.remainingTimeTimerRideBegin < 5
|
||||
// ? MyElevatedButton(
|
||||
// title:
|
||||
// 'If you in destination Now. Press finish The Ride',
|
||||
// onPressed: () async {
|
||||
//todo finish the trip and rest all counter ,start new counter of the trip time
|
||||
|
||||
// await CRUD()
|
||||
// .post(link: AppLink.updateRides, payload: {
|
||||
// 'id': controller.rideId,
|
||||
// 'rideTimeStart': DateTime.now().toString(),
|
||||
// 'status': 'Applied'
|
||||
// });
|
||||
// controller.driverArrivePassenger();
|
||||
// // Send notification to driver to alert him that trip is begin
|
||||
// FirebaseMessagesController()
|
||||
// .sendNotificationToAnyWithoutData(
|
||||
// 'BeginTrip',
|
||||
// box.read(BoxName.name).toString(),
|
||||
// controller.driverToken.toString(),
|
||||
// );
|
||||
// print(controller.driverToken.toString());
|
||||
// Get.defaultDialog(
|
||||
// title: 'The Ride is Begin'.tr,
|
||||
// backgroundColor: AppColor.greenColor,
|
||||
// );
|
||||
// })
|
||||
// : const SizedBox()
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../constant/box_name.dart';
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../controller/home/map_passenger_controller.dart';
|
||||
import '../../../controller/profile/profile_controller.dart';
|
||||
import '../../../main.dart';
|
||||
|
||||
class RideFromStartApp extends StatelessWidget {
|
||||
const RideFromStartApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProfileController profileController = Get.put(ProfileController());
|
||||
return GetBuilder<MapPassengerController>(builder: (controller) {
|
||||
return (controller.statusRideFromStart ||
|
||||
controller.statusRide == 'Begin')
|
||||
@@ -20,38 +26,98 @@ class RideFromStartApp extends StatelessWidget {
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
height: 200,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
'${'duration is'.tr} ${controller.rideStatusFromStartApp['data']['endtime']}',
|
||||
'${controller.rideStatusFromStartApp['data']['endtime']} ⏱️',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'${'price is'.tr} ${controller.rideStatusFromStartApp['data']['price']} 💵',
|
||||
'${controller.rideStatusFromStartApp['data']['distance']} 📍',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'${'distance is'.tr} ${controller.rideStatusFromStartApp['data']['distance']}',
|
||||
'${controller.rideStatusFromStartApp['data']['price']} 💵',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
'${'driver name is'.tr} ${controller.rideStatusFromStartApp['data']['driverName']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'${'driver name is'.tr} ${controller.rideStatusFromStartApp['data']['rateDriver']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 30,
|
||||
backgroundImage: NetworkImage(
|
||||
// '',
|
||||
// ),
|
||||
'https://ride.mobile-app.store/portrate_captain_image/${controller.rideStatusFromStartApp['data']['driver_id']}.jpg'),
|
||||
),
|
||||
Text(
|
||||
'${'driver name is'.tr} ${controller.rideStatusFromStartApp['data']['driverName']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'${'driver name is'.tr} ${controller.rideStatusFromStartApp['data']['rateDriver']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
if (box.read(BoxName.sosPhonePassenger) == null) {
|
||||
{
|
||||
await profileController.updatField(
|
||||
'sosPhone', TextInputType.phone);
|
||||
box.write(BoxName.sosPhonePassenger,
|
||||
profileController.prfoileData['sosPhone']);
|
||||
}
|
||||
} else {
|
||||
controller
|
||||
.sendSMS(box.read(BoxName.sosPhonePassenger));
|
||||
}
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.sos_rounded,
|
||||
color: AppColor.redColor,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
print(box.read(BoxName.sosPhonePassenger));
|
||||
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', '');
|
||||
print(phoneNumber); // Output: 798583061
|
||||
var phone =
|
||||
// '+${box.read(BoxName.countryCode)}${box.read(BoxName.sosPhonePassenger)}';
|
||||
'+20${box.read(BoxName.sosPhonePassenger)}';
|
||||
controller.sendWhatsapp(phone);
|
||||
}
|
||||
},
|
||||
icon: const Icon(
|
||||
FontAwesome.whatsapp,
|
||||
color: AppColor.greenColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user