10/16/1
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/controller/profile/profile_controller.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
@@ -13,6 +16,7 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProfileController profileController = Get.put(ProfileController());
|
||||
return GetBuilder<MapPassengerController>(builder: (controller) {
|
||||
if (controller.rideTimerBegin) {
|
||||
return Positioned(
|
||||
@@ -26,6 +30,7 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'You will arrive to your destination after '.tr,
|
||||
@@ -50,34 +55,137 @@ 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
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
if (box.read(BoxName.sosPhonePassenger).toString() ==
|
||||
'') {
|
||||
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
|
||||
validator: (value) {
|
||||
if (value!.isEmpty ||
|
||||
value.length < 10) {
|
||||
return 'Please enter a phone number';
|
||||
}
|
||||
// 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));
|
||||
}
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.sos_rounded,
|
||||
color: AppColor.redColor,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
if (box.read(BoxName.sosPhonePassenger).toString() ==
|
||||
'') {
|
||||
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
|
||||
validator: (value) {
|
||||
if (value!.isEmpty ||
|
||||
value.length < 10) {
|
||||
return 'Please enter a phone number';
|
||||
}
|
||||
// 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.sendWhatsapp(
|
||||
box.read(BoxName.sosPhonePassenger));
|
||||
}
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.ring_volume,
|
||||
color: AppColor.blueColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
// 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()
|
||||
// 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()
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user