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, title: 'No i want'.tr,
onPressed: () { onPressed: () {
box.write(BoxName.tipPercentage, '0'); box.write(BoxName.tipPercentage, '0');
controller.update();
}), }),
Container( Container(
decoration: AppStyle.boxDecoration1, decoration: AppStyle.boxDecoration1,

View File

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

View File

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

View File

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

View File

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

View File

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