This commit is contained in:
Hamza Aleghwairyeen
2024-04-01 03:41:04 +03:00
parent 398c3c8f9d
commit b710fe314e
8 changed files with 252 additions and 119 deletions

BIN
assets/images/freeRide.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

1
devtools_options.yaml Normal file
View File

@@ -0,0 +1 @@
extensions:

View File

@@ -97,14 +97,14 @@ class OrderRequestController extends GetxController {
update(); update();
} }
if (remainingTimeSpeed == 0) { // if (remainingTimeSpeed == 0) {
if (applied == false) { // if (applied == false) {
print('applied========================='); // print('applied=========================');
print(applied); // print(applied);
Get.back(); // Get.back();
// refuseOrder(box.read(BoxName.driverID), orderID); // // refuseOrder(box.read(BoxName.driverID), orderID);
} // }
} // }
} }
void refuseOrder(orderID) async { void refuseOrder(orderID) async {

View File

@@ -471,7 +471,7 @@ class MapPassengerController extends GetxController {
// Format the message. // Format the message.
String message = String message =
'${'${'Hi! This is'.tr} ${box.read(BoxName.name)}.\n${' I am using'.tr}'} ${box.read(AppInformation.appName)}${' to ride with'.tr} $firstName${' as the driver.'.tr} $firstName \n${'is driving a '.tr}$model\n${' with license plate '.tr}$licensePlate.\n${' I am currently located at '.tr}$passengerLocation.\n${' If you need to reach me, please contact the driver directly at'.tr}\n\n $driverPhone.'; '${'${'Hi! This is'.tr} ${box.read(BoxName.name)}.\n${' I am using'.tr}'} ${AppInformation.appName}${' to ride with'.tr} $firstName${' as the driver.'.tr} $firstName \n${'is driving a '.tr}$model\n${' with license plate '.tr}$licensePlate.\n${' I am currently located at '.tr} https://www.google.com/maps/place/${passengerLocation.latitude},${passengerLocation.longitude}.\n${' If you need to reach me, please contact the driver directly at'.tr}\n\n $driverPhone.';
// Launch the URL to send the SMS. // Launch the URL to send the SMS.
launchCommunication('whatsapp', to, message); launchCommunication('whatsapp', to, message);
@@ -1199,18 +1199,16 @@ class MapPassengerController extends GetxController {
} }
void reloadMarkerDriverCarsLocationToPassengerAfterApplied() { void reloadMarkerDriverCarsLocationToPassengerAfterApplied() {
// Clear existing markers
// markers.clear();
// update();
clearMarkersExceptStartEnd(); clearMarkersExceptStartEnd();
// for (var i = 0; i < driverCarsLocationToPassengerAfterApplied.length; i++) { // for (var i = 0; i < driverCarsLocationToPassengerAfterApplied.length; i++) {
LatLng driverPosition = LatLng(
double.parse(
datadriverCarsLocationToPassengerAfterApplied[0]['latitude']),
double.parse(
datadriverCarsLocationToPassengerAfterApplied[0]['longitude']));
final driverAcceptedMarker = Marker( final driverAcceptedMarker = Marker(
markerId: const MarkerId('driverToPassengers'), markerId: const MarkerId('driverToPassengers'),
position: LatLng( position: driverPosition,
double.parse(
datadriverCarsLocationToPassengerAfterApplied[0]['latitude']),
double.parse(
datadriverCarsLocationToPassengerAfterApplied[0]['longitude'])),
rotation: double.parse( rotation: double.parse(
datadriverCarsLocationToPassengerAfterApplied['message'][0] datadriverCarsLocationToPassengerAfterApplied['message'][0]
['heading']), ['heading']),
@@ -1218,9 +1216,7 @@ class MapPassengerController extends GetxController {
); );
markers.add(driverAcceptedMarker); markers.add(driverAcceptedMarker);
// update(); // update();
mapController?.animateCamera(CameraUpdate.newLatLng(LatLng( mapController?.animateCamera(CameraUpdate.newLatLng(driverPosition));
driverCarsLocationToPassengerAfterApplied[0].latitude,
driverCarsLocationToPassengerAfterApplied[0].longitude)));
update(); update();
// } // Update the map with the new markers // } // Update the map with the new markers
} }

View File

@@ -458,7 +458,12 @@ class MyTranslation extends Translations {
'Are you sure to cancel?': "هل أنت متأكد من الإلغاء؟", 'Are you sure to cancel?': "هل أنت متأكد من الإلغاء؟",
'Yes': 'نعم', 'Yes': 'نعم',
'Insert Emergincy Number': "أدخل رقم الطوارئ", 'Insert Emergincy Number': "أدخل رقم الطوارئ",
'Insert': "إدراج",'You can decline a request without any cost':'‏يمكنك إلغاء الطلب بدون أي تكلفة', 'Best choice for comfort car and flexible route and stops point': 'أفضل اختيار لسيارة مريحة ومسار مرن ونقاط توقف',
'Insert': "إدراج",'This is for delivery or a motorcycle.':"هذا للتسليم أو الدراجة النارية",
'This trip goes directly from your starting point to your destination for a fixed price. The driver must follow the planned route':'الرحلة دي من نقطة البداية لنقطة النهاية بسعر ثابت والسواق لازم يمشي بنفس الطريق.',
'You can decline a request without any cost':
'‏يمكنك إلغاء الطلب بدون أي تكلفة',
'Perfect for adventure seekers who want to experience something new and exciting':'خيار مثالي لللي عايزين يخرجوا من الروتين ويجربوا حاجات جديدة ومثيرة',
" My current location is:": "موقعي الحالي هو:", " My current location is:": "موقعي الحالي هو:",
" \nand I have a trip on": "\nولدي رحلة على", " \nand I have a trip on": "\nولدي رحلة على",
"App \nwith Passenger ": "التطبيق\nمع الراكب ", "App \nwith Passenger ": "التطبيق\nمع الراكب ",

View File

@@ -270,34 +270,6 @@ class OrderSpeedRequest extends StatelessWidget {
), ),
), ),
), ),
// Padding(
// padding: const EdgeInsets.all(8.0),
// child: RichText(
// text: TextSpan(
// text: 'Duration To Passenger is '.tr,
// style: AppStyle.title,
// children: [
// TextSpan(
// text: myList[11].toString(),
// style: AppStyle.headTitle2),
// ],
// ),
// ),
// ),
// Padding(
// padding: const EdgeInsets.all(8.0),
// child: RichText(
// text: TextSpan(
// text: 'Distance To Passenger is '.tr,
// style: AppStyle.title,
// children: [
// TextSpan(
// text: myList[12].toString(),
// style: AppStyle.headTitle2),
// ],
// ),
// ),
// ),
Padding( Padding(
padding: const EdgeInsets.all(4), padding: const EdgeInsets.all(4),
child: Container( child: Container(
@@ -315,36 +287,6 @@ class OrderSpeedRequest extends StatelessWidget {
), ),
), ),
), ),
// Padding(
// padding: const EdgeInsets.all(8.0),
// child: RichText(
// text: TextSpan(
// text: 'Distance from Passenger to destination is '.tr,
// style: AppStyle.title,
// children: [
// TextSpan(
// text: myList[5].toString(),
// style: AppStyle.headTitle2),
// TextSpan(text: ' KM'.tr, style: AppStyle.title),
// ]),
// ),
// ),
// Padding(
// padding: const EdgeInsets.all(8.0),
// child: RichText(
// text: TextSpan(
// text: 'Duration of Trip is '.tr,
// style: AppStyle.title,
// children: [
// TextSpan(
// text: hours > 1
// ? '${'Your Ride Duration is '.tr}$hours${' H and'.tr} $minutes m'
// : '${'Your Ride Duration is '.tr} $minutes m',
// style: AppStyle.title),
// TextSpan(text: ' Minutes'.tr, style: AppStyle.title),
// ]),
// ),
// ),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Row( child: Row(
@@ -356,8 +298,6 @@ class OrderSpeedRequest extends StatelessWidget {
onPressed: () async { onPressed: () async {
box.write(BoxName.statusDriverLocation, 'on'); box.write(BoxName.statusDriverLocation, 'on');
// orderRequestController.changeApplied();
var res = await CRUD() var res = await CRUD()
.post(link: AppLink.updateStausFromSpeed, payload: { .post(link: AppLink.updateStausFromSpeed, payload: {
'id': myList[16], 'id': myList[16],
@@ -378,8 +318,7 @@ class OrderSpeedRequest extends StatelessWidget {
middleTextStyle: AppStyle.title, middleTextStyle: AppStyle.title,
confirm: MyElevatedButton( confirm: MyElevatedButton(
title: 'Ok'.tr, onPressed: () => Get.back())); title: 'Ok'.tr, onPressed: () => Get.back()));
} else if (json['message'] == } else if (json['status'] == "success") {
"Ride data updated successfully") {
List<String> bodyToPassenger = [ List<String> bodyToPassenger = [
box.read(BoxName.driverID).toString(), box.read(BoxName.driverID).toString(),
box.read(BoxName.nameDriver).toString(), box.read(BoxName.nameDriver).toString(),

View File

@@ -44,7 +44,7 @@ class MapPagePassenger extends StatelessWidget {
const MapMenuWidget(), const MapMenuWidget(),
const MenuIconMapPageWidget(), const MenuIconMapPageWidget(),
buttomSheetMapPage(), buttomSheetMapPage(),
const CarDetailsTypeToChoose(), CarDetailsTypeToChoose(),
const ApplyOrderWidget(), const ApplyOrderWidget(),
// hexagonClipper(), // hexagonClipper(),
const CancelRidePageShow(), const CancelRidePageShow(),

View File

@@ -6,6 +6,7 @@ import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../controller/functions/tts.dart';
import '../../../controller/home/map_passenger_controller.dart'; import '../../../controller/home/map_passenger_controller.dart';
class CarType { class CarType {
@@ -31,11 +32,15 @@ List<CarType> carTypes = [
carType: 'Delivery'.tr, carType: 'Delivery'.tr,
carDetail: 'Delivery service'.tr, carDetail: 'Delivery service'.tr,
image: 'assets/images/moto.png'), image: 'assets/images/moto.png'),
CarType(
carType: 'Free Ride'.tr,
carDetail: 'free ride without end point'.tr,
image: 'assets/images/freeRide.png'),
]; ];
class CarDetailsTypeToChoose extends StatelessWidget { class CarDetailsTypeToChoose extends StatelessWidget {
const CarDetailsTypeToChoose({super.key}); CarDetailsTypeToChoose({super.key});
final textToSpeechController = Get.put(TextToSpeechController());
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GetBuilder<MapPassengerController>( return GetBuilder<MapPassengerController>(
@@ -59,7 +64,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
SizedBox( SizedBox(
height: Get.height * .3, height: Get.height * .4,
child: ListView.builder( child: ListView.builder(
itemCount: carTypes.length, itemCount: carTypes.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
@@ -117,9 +122,11 @@ class CarDetailsTypeToChoose extends StatelessWidget {
? mapPassengerController ? mapPassengerController
.totalPassenger .totalPassenger
.toStringAsFixed(2) .toStringAsFixed(2)
: mapPassengerController : carType.carType == 'Delivery'
.totalPassengerMotoDelivery ? mapPassengerController
.toStringAsFixed(2), .totalPassengerMotoDelivery
.toStringAsFixed(2)
: '50',
style: AppStyle.title style: AppStyle.title
.copyWith(fontSize: 20), .copyWith(fontSize: 20),
), ),
@@ -177,40 +184,184 @@ class CarDetailsTypeToChoose extends StatelessWidget {
onTap: () { onTap: () {
mapPassengerController.selectCarFromList(index); mapPassengerController.selectCarFromList(index);
if (mapPassengerController.selectedIndex != -1) {
// Get.snackbar('You should select one'.tr, '',
// backgroundColor: AppColor.greenColor);
if (mapPassengerController.selectedIndex == 0) {
box.write(BoxName.carType, 'Comfort');
mapPassengerController.totalPassenger =
mapPassengerController
.totalPassengerComfort;
Get.defaultDialog(
title: 'Comfort',
titleStyle: AppStyle.title,
content: CarDialogue(
textToSpeechController:
textToSpeechController,
image: 'assets/images/blob.png',
text:
'Best choice for comfort car and flexible route and stops point'
.tr),
confirm: MyElevatedButton(
kolor: AppColor.greenColor,
title: 'Next'.tr,
onPressed: () {
Get.back();
mapPassengerController
.isBottomSheetShown = false;
mapPassengerController.update();
mapPassengerController
.changeCashConfirmPageShown();
}),
cancel: MyElevatedButton(
title: 'Cancel'.tr,
kolor: AppColor.redColor,
onPressed: () {
Get.back();
}));
} else if (mapPassengerController
.selectedIndex ==
1) {
box.write(BoxName.carType, 'Speed');
mapPassengerController.totalPassenger =
mapPassengerController.totalPassenger;
Get.defaultDialog(
title: 'Speed',
titleStyle: AppStyle.title,
content: CarDialogue(
textToSpeechController:
textToSpeechController,
image: 'assets/images/carspeed.png',
text:
'This trip goes directly from your starting point to your destination for a fixed price. The driver must follow the planned route'
.tr),
confirm: MyElevatedButton(
kolor: AppColor.greenColor,
title: 'Next'.tr,
onPressed: () {
Get.back();
mapPassengerController
.isBottomSheetShown = false;
mapPassengerController.update();
mapPassengerController
.changeCashConfirmPageShown();
}),
cancel: MyElevatedButton(
title: 'Cancel'.tr,
kolor: AppColor.redColor,
onPressed: () {
Get.back();
}));
} else if (mapPassengerController
.selectedIndex ==
2) {
box.write(BoxName.carType, 'Delivery');
mapPassengerController.totalPassenger =
mapPassengerController
.totalPassengerMotoDelivery;
Get.defaultDialog(
title: 'Delivery',
titleStyle: AppStyle.title,
content: CarDialogue(
textToSpeechController:
textToSpeechController,
image: 'assets/images/moto.png',
text:
'This is for delivery or a motorcycle.'
.tr),
confirm: MyElevatedButton(
kolor: AppColor.greenColor,
title: 'Next'.tr,
onPressed: () {
Get.back();
mapPassengerController
.isBottomSheetShown = false;
mapPassengerController.update();
mapPassengerController
.changeCashConfirmPageShown();
}),
cancel: MyElevatedButton(
title: 'Cancel'.tr,
kolor: AppColor.redColor,
onPressed: () {
Get.back();
}));
} else if (mapPassengerController
.selectedIndex ==
3) {
box.write(BoxName.carType, 'FreeRide');
mapPassengerController.totalPassenger = 50;
Get.defaultDialog(
title: 'FreeRide',
titleStyle: AppStyle.title,
content: CarDialogue(
textToSpeechController:
textToSpeechController,
image: 'assets/images/freeRide.png',
text:
'Perfect for adventure seekers who want to experience something new and exciting'
.tr),
confirm: MyElevatedButton(
kolor: AppColor.greenColor,
title: 'Next'.tr,
onPressed: () {
Get.back();
mapPassengerController
.isBottomSheetShown = false;
mapPassengerController.update();
mapPassengerController
.changeCashConfirmPageShown();
}),
cancel: MyElevatedButton(
title: 'Cancel'.tr,
kolor: AppColor.redColor,
onPressed: () {
Get.back();
}));
}
} else {
Get.snackbar('You should select one'.tr, '',
backgroundColor: AppColor.redColor);
}
}, },
); );
}, },
), ),
), ),
MyElevatedButton( // MyElevatedButton(
title: 'Next'.tr, // title: 'Next'.tr,
onPressed: () { // onPressed: () {
if (mapPassengerController.selectedIndex != -1) { // if (mapPassengerController.selectedIndex != -1) {
// Get.snackbar('You should select one'.tr, '', // // Get.snackbar('You should select one'.tr, '',
// backgroundColor: AppColor.greenColor); // // backgroundColor: AppColor.greenColor);
if (mapPassengerController.selectedIndex == 0) { // if (mapPassengerController.selectedIndex == 0) {
box.write(BoxName.carType, 'Comfort'); // box.write(BoxName.carType, 'Comfort');
mapPassengerController.totalPassenger = // mapPassengerController.totalPassenger =
mapPassengerController.totalPassengerComfort; // mapPassengerController.totalPassengerComfort;
} else if (mapPassengerController.selectedIndex == // } else if (mapPassengerController.selectedIndex ==
1) { // 1) {
box.write(BoxName.carType, 'Speed'); // box.write(BoxName.carType, 'Speed');
} else if (mapPassengerController.selectedIndex == // } else if (mapPassengerController.selectedIndex ==
2) { // 2) {
box.write(BoxName.carType, 'Delivery'); // box.write(BoxName.carType, 'Delivery');
mapPassengerController.totalPassenger = // mapPassengerController.totalPassenger =
mapPassengerController // mapPassengerController
.totalPassengerMotoDelivery; // .totalPassengerMotoDelivery;
} // } else if (mapPassengerController.selectedIndex ==
mapPassengerController.isBottomSheetShown = false; // 3) {
mapPassengerController.update(); // box.write(BoxName.carType, 'FreeRide');
mapPassengerController.changeCashConfirmPageShown(); // mapPassengerController.totalPassenger = 50;
// mapPassengerController.confirmRideForFirstDriver(); // }
} else { // mapPassengerController.isBottomSheetShown = false;
Get.snackbar('You should select one'.tr, '', // mapPassengerController.update();
backgroundColor: AppColor.redColor); // mapPassengerController.changeCashConfirmPageShown();
} // // mapPassengerController.confirmRideForFirstDriver();
}) // } else {
// Get.snackbar('You should select one'.tr, '',
// backgroundColor: AppColor.redColor);
// }
// })
], ],
), ),
), ),
@@ -220,3 +371,44 @@ class CarDetailsTypeToChoose extends StatelessWidget {
}); });
} }
} }
class CarDialogue extends StatelessWidget {
const CarDialogue({
super.key,
required this.textToSpeechController,
required this.image,
required this.text,
});
final TextToSpeechController textToSpeechController;
final String image, text;
@override
Widget build(BuildContext context) {
return Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
image,
width: 50,
),
IconButton(
onPressed: () {
textToSpeechController.speakText(
text,
);
},
icon: const Icon(Icons.headphones)),
],
),
Text(
text.tr,
style: AppStyle.title,
textAlign: TextAlign.center,
),
],
);
}
}