This commit is contained in:
Hamza-Ayed
2024-05-31 12:13:19 +03:00
parent efec9eb6a2
commit 794bc8fb24
5 changed files with 130 additions and 36 deletions

BIN
assets/images/lady.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

View File

@@ -217,6 +217,7 @@ class MapPassengerController extends GetxController {
late double totalPassengerComfortDiscount = 0; late double totalPassengerComfortDiscount = 0;
late double totalPassengerLadyDiscount = 0; late double totalPassengerLadyDiscount = 0;
late double totalPassengerSpeedDiscount = 0; late double totalPassengerSpeedDiscount = 0;
late double totalPassengerRaihGaiDiscount = 0;
late double totalPassengerMotoDelivery = 0; late double totalPassengerMotoDelivery = 0;
late double totalDriver = 0; late double totalDriver = 0;
late double averageDuration = 0; late double averageDuration = 0;
@@ -2075,7 +2076,10 @@ class MapPassengerController extends GetxController {
late LatLngBounds boundsData; late LatLngBounds boundsData;
late String startNameAddress = ''; late String startNameAddress = '';
late String endNameAddress = ''; late String endNameAddress = '';
getMap(String origin, destination) async { getMap(String origin, destination) async {
isLoading = true;
update();
remainingTime = 25; //to make cancel every call remainingTime = 25; //to make cancel every call
await getCarsLocationByPassengerAndReloadMarker(); await getCarsLocationByPassengerAndReloadMarker();
// //print(carsLocationByPassenger); // //print(carsLocationByPassenger);
@@ -2382,6 +2386,7 @@ class MapPassengerController extends GetxController {
double costForDriver = 0; double costForDriver = 0;
double totalPassengerSpeed = 0; double totalPassengerSpeed = 0;
double totalPassengerLady = 0; double totalPassengerLady = 0;
double totalPassengerRayehGai = 0;
Future bottomSheet() async { Future bottomSheet() async {
if (data.isNotEmpty) { if (data.isNotEmpty) {
durationToAdd = Duration(seconds: durationToRide); durationToAdd = Duration(seconds: durationToRide);
@@ -2396,9 +2401,10 @@ class MapPassengerController extends GetxController {
costDuration = (durationToRide / 60).floorToDouble(); costDuration = (durationToRide / 60).floorToDouble();
print('costDuration----- $costDuration'); print('costDuration----- $costDuration');
print('costDistance----- $costDistance'); print('costDistance----- $costDistance');
print('Distance----- $distance');
print( print(
'passengerWalletTotal----- ${box.read(BoxName.passengerWalletTotal)}'); 'passengerWalletTotal----- ${box.read(BoxName.passengerWalletTotal)}');
double costComfort, costSpeed, costDelivery, costLady = 0; double costComfort, costSpeed, costDelivery, costLady, costRayehGai = 0;
update(); update();
if (currentTime.hour >= 22 && currentTime.hour < 5) { if (currentTime.hour >= 22 && currentTime.hour < 5) {
// costDistance = distance * latePrice; // costDistance = distance * latePrice;
@@ -2406,6 +2412,9 @@ class MapPassengerController extends GetxController {
costSpeed = (distance * speedPrice) + costDuration * latePrice; costSpeed = (distance * speedPrice) + costDuration * latePrice;
costDelivery = (distance * deliveryPrice) + costDuration * latePrice; costDelivery = (distance * deliveryPrice) + costDuration * latePrice;
costLady = (distance * comfortPrice + 2) + costDuration * latePrice; costLady = (distance * comfortPrice + 2) + costDuration * latePrice;
costRayehGai = (distance * 2 * speedPrice) -
((distance * 2 * speedPrice) * .3) +
costDuration * latePrice;
update(); update();
} else if (currentTime.hour >= 13 && currentTime.hour <= 16) { } else if (currentTime.hour >= 13 && currentTime.hour <= 16) {
@@ -2415,6 +2424,9 @@ class MapPassengerController extends GetxController {
costSpeed = (distance * speedPrice) + costDuration * heavyPrice; costSpeed = (distance * speedPrice) + costDuration * heavyPrice;
costDelivery = (distance * deliveryPrice) + costDuration * heavyPrice; costDelivery = (distance * deliveryPrice) + costDuration * heavyPrice;
costLady = (distance * comfortPrice + 2) + costDuration * heavyPrice; costLady = (distance * comfortPrice + 2) + costDuration * heavyPrice;
costRayehGai = (distance * 2 * speedPrice) -
((distance * 2 * speedPrice) * .3) +
costDuration * heavyPrice;
update(); update();
// } / // } /
@@ -2424,6 +2436,9 @@ class MapPassengerController extends GetxController {
costSpeed = (distance * speedPrice) + costDuration; costSpeed = (distance * speedPrice) + costDuration;
costDelivery = (distance * deliveryPrice) + costDuration; costDelivery = (distance * deliveryPrice) + costDuration;
costLady = (distance * comfortPrice + 2) + costDuration; costLady = (distance * comfortPrice + 2) + costDuration;
costRayehGai = (distance * 2 * speedPrice) -
((distance * 2 * speedPrice) * .3) +
costDuration;
update(); update();
} }
//print('cost $cost'); //print('cost $cost');
@@ -2436,12 +2451,16 @@ class MapPassengerController extends GetxController {
totalPassengerLady = (costLady + (costLady * kazan / 100)).ceilToDouble(); totalPassengerLady = (costLady + (costLady * kazan / 100)).ceilToDouble();
totalPassengerSpeed = totalPassengerSpeed =
(costSpeed + (costSpeed * kazan / 100)).ceilToDouble(); (costSpeed + (costSpeed * kazan / 100)).ceilToDouble();
totalPassengerRayehGai =
(costRayehGai + (costRayehGai * kazan / 100)).ceilToDouble();
totalPassengerComfortDiscount = totalPassengerComfortDiscount =
totalPassengerComfort + totalPassengerComfort * (kazan - 0) / 100; totalPassengerComfort + totalPassengerComfort * (kazan - 0) / 100;
totalPassengerLadyDiscount = totalPassengerLadyDiscount =
totalPassengerLady + totalPassengerLady * (kazan - 0) / 100; totalPassengerLady + totalPassengerLady * (kazan - 0) / 100;
totalPassengerSpeedDiscount = totalPassengerSpeedDiscount =
totalPassengerSpeed + totalPassengerSpeed * (kazan - 2) / 100; totalPassengerSpeed + totalPassengerSpeed * (kazan - 2) / 100;
totalPassengerRaihGaiDiscount =
totalPassengerRayehGai + totalPassengerRayehGai * (kazan - 2) / 100;
totalPassengerMotoDelivery = totalPassengerMotoDelivery =
(costDelivery + (costDelivery * kazan / 100)).ceilToDouble(); (costDelivery + (costDelivery * kazan / 100)).ceilToDouble();
totalPassengerComfort = totalPassengerComfortDiscount - totalPassengerComfort = totalPassengerComfortDiscount -

View File

@@ -4,6 +4,18 @@ class MyTranslation extends Translations {
@override @override
Map<String, Map<String, String>> get keys => { Map<String, Map<String, String>> get keys => {
"ar": { "ar": {
"Best choice for cities": "أفضل اختيار للمدن",
"Rayeh Gai: Round trip service for convenient travel between cities, easy and reliable.":
" رايح جاي: خدمة ذهاب وعودة للسفر المريح بين المدن، سهلة وموثوقة.",
"Rayeh Gai": "رايح جاي ",
"This trip is for women only": "هذه الرحلة للنساء فقط",
"Total budgets on month": "إجمالي الميزانية لهذا الشهر",
"You have call from driver": " لديك مكالمة من السائق",
"Comfort": "كمفورت",
"Speed": "سبيد",
"Lady": "ليدي",
"Delivery": "توصيل",
"Mashwari": "‏مشواري",
'The driver waiting you in picked location .': 'The driver waiting you in picked location .':
"السائق ينتظرك في موقع الركوب.", "السائق ينتظرك في موقع الركوب.",
'About Us': "نبذة عنا", 'About Us': "نبذة عنا",

View File

@@ -22,25 +22,30 @@ class CarType {
List<CarType> carTypes = [ List<CarType> carTypes = [
CarType( CarType(
carType: 'Comfort', carType: 'Comfort',
carDetail: 'Comfort choice'.tr, carDetail: 'Comfort choice'.tr,
image: 'assets/images/blob.png'), image: 'assets/images/blob.png',
),
CarType( CarType(
carType: 'Speed', carType: 'Speed',
carDetail: 'Closest & Cheapest'.tr, carDetail: 'Closest & Cheapest'.tr,
image: 'assets/images/carspeed.png'), image: 'assets/images/carspeed.png',
),
CarType( CarType(
carType: 'Lady', carType: 'Lady',
carDetail: 'Lady Captain for girls'.tr, carDetail: 'Lady Captain for girls'.tr,
image: 'assets/images/blob.png'), image: 'assets/images/lady.png',
),
CarType( CarType(
carType: 'Delivery', carType: 'Delivery',
carDetail: 'Delivery service'.tr, carDetail: 'Delivery service'.tr,
image: 'assets/images/moto.png'), image: 'assets/images/moto.png',
),
CarType( CarType(
carType: 'Mashwari', carType: 'Mashwari',
carDetail: 'Mashwari without end point'.tr, carDetail: 'Mashwari without end point'.tr,
image: 'assets/images/freeRide.png'), image: 'assets/images/freeRide.png',
),
]; ];
class CarDetailsTypeToChoose extends StatelessWidget { class CarDetailsTypeToChoose extends StatelessWidget {
@@ -50,6 +55,25 @@ class CarDetailsTypeToChoose extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GetBuilder<MapPassengerController>( return GetBuilder<MapPassengerController>(
builder: (mapPassengerController) { builder: (mapPassengerController) {
if (mapPassengerController.distance > 80) {
carTypes.add(
CarType(
carType: 'Rayeh Gai',
carDetail: "Best choice for cities".tr,
image: 'assets/images/freeRide.png',
),
);
} // Create a Set to remove duplicates based on the `carType` field
Set<CarType> uniqueCarTypes = {};
uniqueCarTypes.addAll(carTypes);
// Convert the Set back to a List
carTypes = uniqueCarTypes.toList();
if (carTypes.length > 6) {
carTypes.removeRange(6, carTypes.length);
}
return mapPassengerController.data.isNotEmpty && return mapPassengerController.data.isNotEmpty &&
mapPassengerController.isBottomSheetShown && mapPassengerController.isBottomSheetShown &&
mapPassengerController.rideConfirm == false mapPassengerController.rideConfirm == false
@@ -99,7 +123,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Text( Text(
carType.carType, carType.carType.tr,
style: AppStyle.title.copyWith( style: AppStyle.title.copyWith(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 20), fontSize: 20),
@@ -128,7 +152,12 @@ class CarDetailsTypeToChoose extends StatelessWidget {
? mapPassengerController ? mapPassengerController
.totalPassengerLady .totalPassengerLady
.toStringAsFixed(2) .toStringAsFixed(2)
: '50', : carType.carType ==
'Rayeh Gai'
? mapPassengerController
.totalPassengerRayehGai
.toStringAsFixed(2)
: '50',
style: style:
AppStyle.title.copyWith(fontSize: 20), AppStyle.title.copyWith(fontSize: 20),
), ),
@@ -403,9 +432,42 @@ class CarDetailsTypeToChoose extends StatelessWidget {
content: CarDialogue( content: CarDialogue(
textToSpeechController: textToSpeechController:
textToSpeechController, textToSpeechController,
image: 'assets/images/blob.png', image: 'assets/images/lady.png',
text: 'This trip just for girls only' text:
.tr), "This trip is for women only".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 ==
5) {
box.write(BoxName.carType, 'Rayeh Gai');
mapPassengerController.totalPassenger =
mapPassengerController.totalPassengerLady;
Get.defaultDialog(
title: 'Rayeh Gai'.tr,
titleStyle: AppStyle.title,
content: CarDialogue(
textToSpeechController:
textToSpeechController,
image: 'assets/images/lady.png',
text:
"Rayeh Gai: Round trip service for convenient travel between cities, easy and reliable."
.tr),
confirm: MyElevatedButton( confirm: MyElevatedButton(
kolor: AppColor.greenColor, kolor: AppColor.greenColor,
title: 'Next'.tr, title: 'Next'.tr,

View File

@@ -56,7 +56,7 @@ class MainBottomMenuMap extends StatelessWidget {
child: controller.isPickerShown child: controller.isPickerShown
? clickPointPosition( ? clickPointPosition(
controller, context) controller, context)
: whereWidgetsmall(controller), : whereWidgetSmall(controller),
), ),
)), )),
), ),
@@ -122,16 +122,17 @@ class MainBottomMenuMap extends StatelessWidget {
// Get.back(); // Get.back();
// controller.showBottomSheet1(); // controller.showBottomSheet1();
// }), // }),
TextButton( //todo If you want add stop click here
onPressed: () { // TextButton(
controller.changeMainBottomMenuMap(); // onPressed: () {
controller.changeWayPointSheet(); // controller.changeMainBottomMenuMap();
}, // controller.changeWayPointSheet();
child: Text( // },
"If you want add stop click here".tr, // child: Text(
style: AppStyle.title, // "If you want add stop click here".tr,
), // style: AppStyle.title,
), // ),
// ),
], ],
) )
], ],
@@ -169,6 +170,7 @@ class MainBottomMenuMap extends StatelessWidget {
confirm: MyElevatedButton( confirm: MyElevatedButton(
title: 'Yes'.tr, title: 'Yes'.tr,
onPressed: () async { onPressed: () async {
Get.back();
await controller.getLocation(); await controller.getLocation();
await controller.getMap( await controller.getMap(
'${controller.passengerLocation.latitude},${controller.passengerLocation.longitude}', '${controller.passengerLocation.latitude},${controller.passengerLocation.longitude}',
@@ -178,7 +180,6 @@ class MainBottomMenuMap extends StatelessWidget {
controller.showBottomSheet1(); controller.showBottomSheet1();
// controller.showBottomSheet1(); // controller.showBottomSheet1();
Get.back();
}, },
)); ));
}, },
@@ -312,7 +313,7 @@ class MainBottomMenuMap extends StatelessWidget {
); );
} }
Row whereWidgetsmall(MapPassengerController controller) { Row whereWidgetSmall(MapPassengerController controller) {
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
@@ -367,8 +368,8 @@ class MainBottomMenuMap extends StatelessWidget {
} }
} }
class FavioratePlacesDialogu extends StatelessWidget { class FaviouratePlacesDialog extends StatelessWidget {
const FavioratePlacesDialogu({ const FaviouratePlacesDialog({
super.key, super.key,
}); });