This commit is contained in:
Hamza Aleghwairyeen
2024-04-24 17:26:43 +03:00
parent 84e70e6275
commit a9c570cab7
6 changed files with 103 additions and 105 deletions

View File

@@ -769,6 +769,7 @@ class DriverTipWidget extends StatelessWidget {
title: 'No i want'.tr,
onPressed: () {
box.write(BoxName.tipPercentage, '0');
controller.update();
}),
Container(
decoration: AppStyle.boxDecoration1,

View File

@@ -445,7 +445,7 @@ class MapDriverController extends GetxController {
isRideFinished = true;
isRideStarted = false;
isPriceWindow = false;
totalCost = carType != 'Comfort' || carType != 'Mashwari'
totalCost = carType != 'Comfort' && carType != 'Mashwari'
? totalPassenger
: price < double.parse(totalPassenger)
? totalPassenger

View File

@@ -2311,6 +2311,7 @@ class MapPassengerController extends GetxController {
}
double costForDriver = 0;
double totalPassengerSpeed = 0;
Future bottomSheet() async {
if (data.isNotEmpty) {
durationToAdd = Duration(seconds: durationToRide);
@@ -2361,20 +2362,21 @@ class MapPassengerController extends GetxController {
totalCostPassenger = totalDriver1 + (totalDriver1 * kazan / 100);
totalPassenger = costSpeed + (costSpeed * kazan / 100);
totalPassengerComfort = costComfort + (costComfort * kazan / 100);
// totalPassengerComfort = totalCostPassenger + (totalCostPassenger * .2);
totalPassengerSpeed = costSpeed + (costSpeed * kazan / 100);
totalPassengerComfortDiscount =
totalPassengerComfort + totalPassengerComfort * (kazan - 4) / 100;
totalPassengerComfort + totalPassengerComfort * (kazan - 10) / 100;
totalPassengerMotoDelivery = costDelivery + (costDelivery * kazan / 100);
totalDriver = totalDriver1 + (totalDriver1 * kazan / 100);
tax = totalCostPassenger * kazan / 100;
totalME = totalCostPassenger - tax;
costForDriver = fuelPrice * (20 / 210) * distance;
print('cost for driver = $costForDriver');
if (totalCostPassenger < 20) {
// for eygpt 20 le open ride
totalCostPassenger = 20;
totalPassengerSpeed = 20;
totalPassengerComfort = 30;
totalPassengerMotoDelivery = 20;
totalPassengerMotoDelivery = 18;
} else {
totalPassenger = totalCostPassenger;
update();

View File

@@ -121,7 +121,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
.toStringAsFixed(2)
: carType.carType == 'Speed'
? mapPassengerController
.totalPassenger
.totalPassengerSpeed
.toStringAsFixed(2)
: carType.carType == 'Delivery'
? mapPassengerController
@@ -136,14 +136,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
children: [
Container(
decoration:
const BoxDecoration(
color: AppColor
.greenColor,
borderRadius:
BorderRadius
.all(Radius
.circular(
5))),
AppStyle.boxDecoration1,
child: Text(
'-12%',
style: AppStyle.subtitle
@@ -226,7 +219,8 @@ class CarDetailsTypeToChoose extends StatelessWidget {
1) {
box.write(BoxName.carType, 'Speed');
mapPassengerController.totalPassenger =
mapPassengerController.totalPassenger;
mapPassengerController
.totalPassengerSpeed;
Get.defaultDialog(
title: 'Speed',
titleStyle: AppStyle.title,

View File

@@ -30,7 +30,7 @@ GetBuilder<MapPassengerController> formSearchPlacesDestenation() {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: Get.width * .7,
width: Get.width * .8,
height: 40,
decoration: const BoxDecoration(
color: AppColor.secondaryColor),
@@ -80,92 +80,92 @@ GetBuilder<MapPassengerController> formSearchPlacesDestenation() {
color: AppColor.greenColor,
),
),
IconButton(
onPressed: () async {
List recentLocations = await sql.getCustomQuery('''
SELECT * FROM ${TableName.recentLocations}
ORDER BY id DESC
LIMIT 4
''');
Get.defaultDialog(
title: 'Latest Recent Trip'.tr,
content: recentLocations.isEmpty
? Center(
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
const Icon(
Icons.hourglass_empty_rounded,
size: 99,
color: AppColor.primaryColor,
),
Text(
'You Dont Have Any places yet !'.tr,
style: AppStyle.title,
),
],
),
)
: SizedBox(
height: Get.width * .5,
width: Get.width * .8,
child: ListView.builder(
itemCount: recentLocations.length,
itemBuilder:
(BuildContext context, int index) {
return Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
TextButton(
onPressed: () async {
Get.back();
controller
.convertHintTextDestinationNewPlacesFromRecent(
recentLocations,
index);
},
child: Text(
recentLocations[index]
['name'],
style: AppStyle.title,
),
),
IconButton(
onPressed: () async {
await sql.deleteData(
TableName.placesFavorite,
recentLocations[index]
['id']);
Get.back();
// ignore: use_build_context_synchronously
Toast.show(
context,
'${'You are Delete'.tr} ${recentLocations[index]['name']} ${'from your list'.tr}',
AppColor.redColor);
// Get.snackbar('Deleted'.tr,
// '${'You are Delete'.tr} ${favoritePlaces[index]['name']} from your list',
// backgroundColor:
// AppColor.accentColor);
},
icon: const Icon(
Icons.favorite_outlined),
),
],
);
},
),
),
);
// controller.changeMainBottomMenuMap();
// controller.changePickerShown();
},
icon: const Icon(
Icons.recent_actors,
color: AppColor.blueColor,
),
),
// IconButton(
// onPressed: () async {
// List recentLocations = await sql.getCustomQuery('''
// SELECT * FROM ${TableName.recentLocations}
// ORDER BY id DESC
// LIMIT 4
// ''');
// Get.defaultDialog(
// title: 'Latest Recent Trip'.tr,
// content: recentLocations.isEmpty
// ? Center(
// child: Column(
// mainAxisAlignment:
// MainAxisAlignment.center,
// children: [
// const Icon(
// Icons.hourglass_empty_rounded,
// size: 99,
// color: AppColor.primaryColor,
// ),
// Text(
// 'You Dont Have Any places yet !'.tr,
// style: AppStyle.title,
// ),
// ],
// ),
// )
// : SizedBox(
// height: Get.width * .5,
// width: Get.width * .8,
// child: ListView.builder(
// itemCount: recentLocations.length,
// itemBuilder:
// (BuildContext context, int index) {
// return Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// children: [
// TextButton(
// onPressed: () async {
// Get.back();
// controller
// .convertHintTextDestinationNewPlacesFromRecent(
// recentLocations,
// index);
// },
// child: Text(
// recentLocations[index]
// ['name'],
// style: AppStyle.title,
// ),
// ),
// IconButton(
// onPressed: () async {
// await sql.deleteData(
// TableName.placesFavorite,
// recentLocations[index]
// ['id']);
// Get.back();
// // ignore: use_build_context_synchronously
// Toast.show(
// context,
// '${'You are Delete'.tr} ${recentLocations[index]['name']} ${'from your list'.tr}',
// AppColor.redColor);
// // Get.snackbar('Deleted'.tr,
// // '${'You are Delete'.tr} ${favoritePlaces[index]['name']} from your list',
// // backgroundColor:
// // AppColor.accentColor);
// },
// icon: const Icon(
// Icons.favorite_outlined),
// ),
// ],
// );
// },
// ),
// ),
// );
// // controller.changeMainBottomMenuMap();
// // controller.changePickerShown();
// },
// icon: const Icon(
// Icons.recent_actors,
// color: AppColor.blueColor,
// ),
// ),
],
),
SizedBox(

View File

@@ -94,9 +94,10 @@ class MainBottomMenuMap extends StatelessWidget {
? const SizedBox()
: Column(
children: [
controller.currentLocationToFormPlaces
? const SizedBox()
: formSearchPlacesStart(),
// controller.currentLocationToFormPlaces
// ? const SizedBox()
// :
// formSearchPlacesStart(),
formSearchPlacesDestenation(),
const SizedBox(
height: 10,