This commit is contained in:
Hamza-Ayed
2024-05-10 14:53:16 +03:00
parent c5ac5c2b22
commit 4192c1e471
9 changed files with 166 additions and 77 deletions

View File

@@ -4,6 +4,7 @@ class AppColor {
static const Color primaryColor = Colors.black;
static const Color secondaryColor = Colors.white;
static const Color accentColor = Colors.grey;
static const Color pink = Colors.purpleAccent;
static const Color redColor = Color(0xFFEA4335); // Google Red
static const Color greenColor = Color(0xFF34A853); // Google Green
static const Color blueColor = Color(0xFF4285F4); // Google Blue

View File

@@ -110,6 +110,20 @@ class FirebaseMessagesController extends GetxController {
fireBaseTitles(message);
}
});
FirebaseMessaging.onBackgroundMessage((RemoteMessage message) async {
// Handle background message
if (message.data.isNotEmpty && message.notification != null) {
print(message.notification?.title);
fireBaseTitles(message);
}
});
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
if (message.data.isNotEmpty && message.notification != null) {
print(message.notification?.title);
fireBaseTitles(message);
}
});
}
void fireBaseTitles(RemoteMessage message) {

View File

@@ -215,6 +215,7 @@ class MapPassengerController extends GetxController {
late double totalCostPassenger = 0;
late double totalPassengerComfort = 0;
late double totalPassengerComfortDiscount = 0;
late double totalPassengerLadyDiscount = 0;
late double totalPassengerSpeedDiscount = 0;
late double totalPassengerMotoDelivery = 0;
late double totalDriver = 0;
@@ -1215,14 +1216,24 @@ class MapPassengerController extends GetxController {
carsLocationByPassenger = [];
LatLngBounds bounds = calculateBounds(
passengerLocation.latitude, passengerLocation.longitude, 7000);
var res =
await CRUD().get(link: AppLink.getCarsLocationByPassenger, payload: {
'southwestLat': bounds.southwest.latitude.toString(),
'southwestLon': bounds.southwest.longitude.toString(),
'northeastLat': bounds.northeast.latitude.toString(),
'northeastLon': bounds.northeast.longitude.toString(),
});
var res;
if (box.read(BoxName.carType) == 'Lady') {
res = await CRUD()
.get(link: AppLink.getFemalDriverLocationByPassenger, payload: {
'southwestLat': bounds.southwest.latitude.toString(),
'southwestLon': bounds.southwest.longitude.toString(),
'northeastLat': bounds.northeast.latitude.toString(),
'northeastLon': bounds.northeast.longitude.toString(),
});
} else {
res = await CRUD()
.get(link: AppLink.getCarsLocationByPassenger, payload: {
'southwestLat': bounds.southwest.latitude.toString(),
'southwestLon': bounds.southwest.longitude.toString(),
'northeastLat': bounds.northeast.latitude.toString(),
'northeastLon': bounds.northeast.longitude.toString(),
});
}
if (res == 'failure') {
noCarString = true;
dataCarsLocationByPassenger = res;
@@ -2358,6 +2369,7 @@ class MapPassengerController extends GetxController {
double costForDriver = 0;
double totalPassengerSpeed = 0;
double totalPassengerLady = 0;
Future bottomSheet() async {
if (data.isNotEmpty) {
durationToAdd = Duration(seconds: durationToRide);
@@ -2374,7 +2386,7 @@ class MapPassengerController extends GetxController {
print('costDistance----- $costDistance');
print(
'passengerWalletTotal----- ${box.read(BoxName.passengerWalletTotal)}');
double costComfort, costSpeed, costDelivery, costMashwari = 0;
double costComfort, costSpeed, costDelivery, costMashwari, costLady = 0;
update();
if (currentTime.hour >= 22 && currentTime.hour < 5) {
// costDistance = distance * latePrice;
@@ -2382,6 +2394,7 @@ class MapPassengerController extends GetxController {
costMashwari = (distance * mashwariPrice) + costDuration * latePrice;
costSpeed = (distance * speedPrice) + costDuration * latePrice;
costDelivery = (distance * deliveryPrice) + costDuration * latePrice;
costLady = (distance * comfortPrice + 2) + costDuration * latePrice;
update();
} else if (currentTime.hour >= 13 && currentTime.hour <= 16) {
@@ -2391,6 +2404,7 @@ class MapPassengerController extends GetxController {
costMashwari = (distance * mashwariPrice) + costDuration * heavyPrice;
costSpeed = (distance * speedPrice) + costDuration * heavyPrice;
costDelivery = (distance * deliveryPrice) + costDuration * heavyPrice;
costLady = (distance * comfortPrice + 2) + costDuration * heavyPrice;
update();
// } /
@@ -2400,6 +2414,7 @@ class MapPassengerController extends GetxController {
costMashwari = (distance * mashwariPrice) + costDuration;
costSpeed = (distance * speedPrice) + costDuration;
costDelivery = (distance * deliveryPrice) + costDuration;
costLady = (distance * comfortPrice + 2) + costDuration;
update();
}
//print('cost $cost');
@@ -2409,14 +2424,23 @@ class MapPassengerController extends GetxController {
totalPassenger = costSpeed + (costSpeed * kazan / 100);
totalPassengerComfort =
(costComfort + (costComfort * kazan / 100)).ceilToDouble();
totalPassengerLady = (costLady + (costLady * kazan / 100)).ceilToDouble();
totalPassengerSpeed =
(costSpeed + (costSpeed * kazan / 100)).ceilToDouble();
totalPassengerComfortDiscount =
totalPassengerComfort + totalPassengerComfort * (kazan - 0) / 100;
totalPassengerLadyDiscount =
totalPassengerLady + totalPassengerLady * (kazan - 0) / 100;
totalPassengerSpeedDiscount =
totalPassengerSpeed + totalPassengerSpeed * (kazan - 2) / 100;
totalPassengerMotoDelivery =
(costDelivery + (costDelivery * kazan / 100)).ceilToDouble();
totalPassengerComfort = totalPassengerComfortDiscount -
(totalPassengerComfortDiscount * kazan / 100);
totalPassengerSpeed = totalPassengerSpeedDiscount -
(totalPassengerSpeedDiscount * kazan / 100);
totalPassengerLady = totalPassengerLadyDiscount -
(totalPassengerLadyDiscount * kazan / 100);
totalDriver = totalDriver1 + (totalDriver1 * kazan / 100);
tax = totalCostPassenger * kazan / 100;
totalME = totalCostPassenger - tax;

View File

@@ -4,6 +4,10 @@ class MyTranslation extends Translations {
@override
Map<String, Map<String, String>> get keys => {
"ar": {
'Pick or Tap to confirm': "اختر أو اضغط للتأكيد",
"To use Wallet charge it": "لاستخدام المحفظة، قم بشحنها.",
'\$ Next as Cash \$!': '\$ Cash \$ ',
'This trip just for girls only': "هذه الرحلة فقط للفتيات ",
'How do I request a ride?': 'كيف يمكنني طلب رحلة؟',
'Step-by-step instructions on how to request a ride through the Sefer app.':
'تعليمات خطوة بخطوة حول كيفية طلب رحلة من خلال تطبيق Sefer.',
@@ -31,7 +35,7 @@ class MyTranslation extends Translations {
'ما هي التدابير الأمنية التي يقدمها Sefer؟',
'Sefer prioritizes your safety. We offer features like driver verification, in-app trip tracking, and emergency contact options.':
'يعمل Sefer على أولوية سلامتك. نحن نقدم ميزات مثل التحقق من السائق، وتتبع الرحلة داخل التطبيق، وخيارات الاتصال بالطوارئ.',
'Frequently questions': 'الأسئلة المتكررة ',
'Frequently Questions': 'الأسئلة المتكررة ',
'About Us': 'عننا',
'SEFER is a ride-sharing app designed with your safety and affordability in mind. We connect you with reliable drivers in your area, ensuring a convenient and stress-free travel experience.\n\nHere are some of the key features that set us apart:':
"سفر هو تطبيق مشاركة رحلات مصمم مع وضع سلامتك وإمكانياتك المادية في الاعتبار. نوفر لك اتصالًا بسائقين موثوقين في منطقتك ، مما يضمن تجربة سفر مريحة وخالية من التوتر.\n\n فيما يلي بعض الميزات الرئيسية التي تميزنا:",

View File

@@ -60,7 +60,7 @@ class HomePage extends StatelessWidget {
ListTile(
leading: const Icon(Icons.question_answer),
title: Text(
'Frequently questions'.tr,
'Frequently Questions'.tr,
style: AppStyle.headTitle2,
),
subtitle:

View File

@@ -29,6 +29,10 @@ List<CarType> carTypes = [
carType: 'Speed',
carDetail: 'Closest & Cheapest'.tr,
image: 'assets/images/carspeed.png'),
CarType(
carType: 'Lady',
carDetail: 'Lady Captain for girls'.tr,
image: 'assets/images/blob.png'),
CarType(
carType: 'Delivery',
carDetail: 'Delivery service'.tr,
@@ -91,7 +95,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
height: 50,
),
SizedBox(
width: Get.width * .4,
width: Get.width * .25,
child: Column(
children: [
Text(
@@ -100,32 +104,36 @@ class CarDetailsTypeToChoose extends StatelessWidget {
fontWeight: FontWeight.bold,
fontSize: 20),
),
Text(
carType.carDetail,
style: AppStyle.subtitle,
),
// Text(
// carType.carDetail,
// style: AppStyle.subtitle,
// ),
],
),
),
Column(
children: [
Text(
carType.carType == 'Comfort'
Text(
carType.carType == 'Comfort'
? mapPassengerController
.totalPassengerComfort
.toStringAsFixed(2)
: carType.carType == 'Speed'
? mapPassengerController
.totalPassengerComfort
.totalPassengerSpeed
.toStringAsFixed(2)
: carType.carType == 'Speed'
: carType.carType == 'Delivery'
? mapPassengerController
.totalPassengerSpeed
.totalPassengerMotoDelivery
.toStringAsFixed(2)
: carType.carType == 'Delivery'
: carType.carType == 'Lady'
? mapPassengerController
.totalPassengerMotoDelivery
.totalPassengerLady
.toStringAsFixed(2)
: '50',
style: AppStyle.title
.copyWith(fontSize: 20),
),
style:
AppStyle.title.copyWith(fontSize: 20),
),
Row(
children: [
carType.carType == 'Comfort' &&
(mapPassengerController
.totalPassengerSpeed >
@@ -192,9 +200,45 @@ class CarDetailsTypeToChoose extends StatelessWidget {
)
],
)
: const SizedBox(
width: 3,
),
: carType.carType == 'Lady' &&
(mapPassengerController
.totalPassengerLady >
20)
? Row(
children: [
Container(
decoration: AppStyle
.boxDecoration1,
child: Text(
'-10%',
style: AppStyle
.subtitle
.copyWith(
color: AppColor
.greenColor),
)),
const SizedBox(
width: 10,
),
Text(
mapPassengerController
.totalPassengerLadyDiscount
.toStringAsFixed(
2),
style: AppStyle.title
.copyWith(
color: AppColor
.redColor,
decoration:
TextDecoration
.lineThrough, // Strikethrough line
),
)
],
)
: const SizedBox(
width: 3,
),
],
),
const SizedBox(
@@ -283,7 +327,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
}));
} else if (mapPassengerController
.selectedIndex ==
2) {
3) {
box.write(BoxName.carType, 'Delivery');
mapPassengerController.totalPassenger =
mapPassengerController
@@ -317,7 +361,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
}));
} else if (mapPassengerController
.selectedIndex ==
3) {
4) {
box.write(BoxName.carType, 'Mashwari');
mapPassengerController.totalPassenger = 50;
Get.defaultDialog(
@@ -347,49 +391,49 @@ class CarDetailsTypeToChoose extends StatelessWidget {
onPressed: () {
Get.back();
}));
} else if (mapPassengerController
.selectedIndex ==
2) {
box.write(BoxName.carType, 'Lady');
mapPassengerController.totalPassenger =
mapPassengerController
.totalPassengerSpeed;
Get.defaultDialog(
title: 'Lady',
titleStyle: AppStyle.title,
content: CarDialogue(
textToSpeechController:
textToSpeechController,
image: 'assets/images/blob.png',
text: 'This trip just for girls 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 {
Get.snackbar('You should select one'.tr, '',
backgroundColor: AppColor.redColor);
}
} else {
Get.snackbar('You should select one'.tr, '',
backgroundColor: AppColor.redColor);
}
},
);
},
),
),
// MyElevatedButton(
// title: 'Next'.tr,
// onPressed: () {
// 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;
// } else if (mapPassengerController.selectedIndex ==
// 1) {
// box.write(BoxName.carType, 'Speed');
// } else if (mapPassengerController.selectedIndex ==
// 2) {
// box.write(BoxName.carType, 'Delivery');
// mapPassengerController.totalPassenger =
// mapPassengerController
// .totalPassengerMotoDelivery;
// } else if (mapPassengerController.selectedIndex ==
// 3) {
// box.write(BoxName.carType, 'FreeRide');
// mapPassengerController.totalPassenger = 50;
// }
// mapPassengerController.isBottomSheetShown = false;
// mapPassengerController.update();
// mapPassengerController.changeCashConfirmPageShown();
// // mapPassengerController.confirmRideForFirstDriver();
// } else {
// Get.snackbar('You should select one'.tr, '',
// backgroundColor: AppColor.redColor);
// }
// })
],
),
),

View File

@@ -29,7 +29,9 @@ class CashConfirmPageShown extends StatelessWidget {
? controller.cashConfirmPageShown
: 0,
decoration: BoxDecoration(
color: AppColor.secondaryColor,
color: box.read(BoxName.carType) == 'Lady'
? Colors.pink.shade100
: AppColor.secondaryColor,
borderRadius: BorderRadius.circular(15)),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
@@ -70,7 +72,7 @@ class CashConfirmPageShown extends StatelessWidget {
),
Text(
// '${'Your Wallet balance is '.tr}JD ',
'${'Your Wallet balance is '.tr} ${box.read(BoxName.passengerWalletTotal).toString()}${' \$'.tr}',
'${'Your Wallet balance is '.tr} ${box.read(BoxName.passengerWalletTotal).toString()} ${box.read(BoxName.countryCode) == 'Egypt' ? 'LE'.tr : 'JOD'.tr}',
style: AppStyle.subtitle,
),
],
@@ -159,7 +161,7 @@ class CashConfirmPageShown extends StatelessWidget {
),
MyElevatedButton(
kolor: AppColor.greenColor,
title: 'Next as Cash \$\$!'.tr,
title: '\$ Next as Cash \$!'.tr,
onPressed: () {
paymentController.isCashChecked = true;
paymentController.isWalletChecked = false;

View File

@@ -288,7 +288,7 @@ class MainBottomMenuMap extends StatelessWidget {
children: [
IconButton(
onPressed: () {
controller.changeMainBottomMenuMap();
// controller.changeMainBottomMenuMap();
},
icon: controller.isMainBottomMenuMap
? const Icon(