From 5c702e7d06d9772c4643f6fc4e1f6d1f596e1ddd Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Fri, 22 Mar 2024 00:03:46 +0300 Subject: [PATCH] 3/21/2 --- lib/controller/firebase/firbase_messge.dart | 6 ++ .../home/captin/map_driver_controller.dart | 12 +++- .../home/map_passenger_controller.dart | 53 +++-------------- lib/controller/local/translations.dart | 2 + lib/onbording_page.dart | 4 +- lib/views/Rate/rate_passenger.dart | 58 +++++++++---------- .../mapDriverWidgets/driver_end_ride_bar.dart | 10 +++- .../home/profile/passenger_profile_page.dart | 10 ++-- 8 files changed, 71 insertions(+), 84 deletions(-) diff --git a/lib/controller/firebase/firbase_messge.dart b/lib/controller/firebase/firbase_messge.dart index e7b6055..6b1e5a2 100644 --- a/lib/controller/firebase/firbase_messge.dart +++ b/lib/controller/firebase/firbase_messge.dart @@ -243,6 +243,12 @@ class FirebaseMessagesController extends GetxController { // 'PolylineJson': myPoints, 'body': message.notification!.body }); + } else if (message.notification!.title! == 'Order Applied') { + NotificationController().showNotification( + 'The order Accepted by another Driver'.tr, + 'We regret to inform you that another driver has accepted this order.' + .tr, + 'order'); } } diff --git a/lib/controller/home/captin/map_driver_controller.dart b/lib/controller/home/captin/map_driver_controller.dart index d46d3e7..d429aa2 100644 --- a/lib/controller/home/captin/map_driver_controller.dart +++ b/lib/controller/home/captin/map_driver_controller.dart @@ -650,8 +650,16 @@ update ui for totla results // Add a new marker with the ID `MyLocation` at the current location of the user. LocationController locationController = Get.find(); myLocation = locationController.myLocation; - final previousLocationOfDrivers = await sql.getCustomQuery( - 'Select * from ${TableName.carLocations} where order_id =$rideId Order by created_at DESC limit 1'); + final previousLocationOfDrivers = await sql.getCustomQuery('''SELECT + * +FROM + ${TableName.carLocations} +WHERE + order_id = $rideId +ORDER BY + created_at DESC +LIMIT + 1'''); //get from sql if (previousLocationOfDrivers.isNotEmpty) { diff --git a/lib/controller/home/map_passenger_controller.dart b/lib/controller/home/map_passenger_controller.dart index f20aed1..50b9f1b 100644 --- a/lib/controller/home/map_passenger_controller.dart +++ b/lib/controller/home/map_passenger_controller.dart @@ -924,20 +924,8 @@ class MapPassengerController extends GetxController { } delayAndFetchRideStatus(rideId); - // if (shouldFetch == false) { - // startTimer(); - // update(); - // } + update(); - // } else { - // Get.defaultDialog( - // title: 'No Car or Driver Found in your area.'.tr, - // titleStyle: AppStyle.title, - // middleText: 'Please Try anther time '.tr, - // middleTextStyle: AppStyle.title.copyWith(color: AppColor.yellowColor), - // confirm: - // MyElevatedButton(title: 'Ok'.tr, onPressed: () => Get.back())); - // } } String statusRide = 'wait'; @@ -949,8 +937,8 @@ class MapPassengerController extends GetxController { .get(link: AppLink.getRideStatus, payload: {'id': rideId}); print(res); var decod = jsonDecode(res); - print(' 0000000000000000000000000000000000000000000000000'); - print(decod['data']); + // print(' 0000000000000000000000000000000000000000000000000'); + // print(decod['data']); if (decod['data'].toString() == 'Apply') { getUpdatedRideForDriverApply(rideId); shouldFetch = false; // Stop further fetches @@ -965,37 +953,12 @@ class MapPassengerController extends GetxController { confirmRideForAllDriverAvailable(); isDriversTokensSend = true; } - // else{ - // j - // } - // else { - // Get.defaultDialog( - // barrierDismissible: false, - // title: 'There no Driver Aplly your order sorry for that '.tr, - // // middleText: 'try next time .'.tr, - // content: IconButton( - // onPressed: () { - // textToSpeechController.speakText( - // 'There no Driver Aplly your order sorry for that '.tr); - // }, - // icon: const Icon( - // Icons.headphones, - // size: 40, - // ), - // ), - // titleStyle: AppStyle.title, - // confirm: MyElevatedButton( - // title: 'Back', - // onPressed: () => Get.offAll(const MapPagePassenger()), - // )); - - // cancelRideAfterRejectFromAll(); - // } - } else { - delayAndFetchRideStatus( - rideId); // Repeat the delay and fetch operation - update(); } + // else if (isDriversTokensSend == false) { + // delayAndFetchRideStatus( + // rideId); // Repeat the delay and fetch operation + // update(); + // } } }); } diff --git a/lib/controller/local/translations.dart b/lib/controller/local/translations.dart index 1661e22..46ba298 100644 --- a/lib/controller/local/translations.dart +++ b/lib/controller/local/translations.dart @@ -386,6 +386,8 @@ class MyTranslation extends Translations { 'Total price from ': 'المبلغ المطلوب من ', 'Order Details Speed': 'طلب سريع', 'Order Applied': "نفذ الطلب", + 'We regret to inform you that another driver has accepted this order.': + 'نأسف لإبلاغك بأن سائقًا آخر قد قبل هذا الطلب', "The order has been accepted by another driver.": 'الطلب اتاخد من سواق تاني.', "Be more mindful next time to avoid dropping orders.": diff --git a/lib/onbording_page.dart b/lib/onbording_page.dart index f40feb6..70a4b8f 100644 --- a/lib/onbording_page.dart +++ b/lib/onbording_page.dart @@ -49,10 +49,10 @@ class CustomSliderOnBoarding extends GetView { Image.asset( onBoardingList[i].image!, // width: , - height: Get.width / 1.3, + height: Get.width / 2, fit: BoxFit.fill, ), - const SizedBox(height: 60), + const SizedBox(height: 20), Text(onBoardingList[i].title!, textAlign: TextAlign.center, style: const TextStyle( diff --git a/lib/views/Rate/rate_passenger.dart b/lib/views/Rate/rate_passenger.dart index d494635..cb69276 100644 --- a/lib/views/Rate/rate_passenger.dart +++ b/lib/views/Rate/rate_passenger.dart @@ -27,35 +27,35 @@ class RatePassenger extends StatelessWidget { decoration: AppStyle.boxDecoration, child: Column( children: [ - Padding( - padding: const EdgeInsets.all(4), - child: Container( - height: Get.height * .25, - decoration: AppStyle.boxDecoration1, - child: Column( - children: [ - Text( - '${'Total price from '.tr}${Get.find().passengerName}', - style: AppStyle.title, - ), - Container( - decoration: BoxDecoration( - border: Border.all( - width: 2, - color: AppColor.greenColor, - )), - child: Padding( - padding: const EdgeInsets.all(4), - child: Text( - Get.find() - .totalPassenger, - style: AppStyle.number, - ), - ), - ), - ], - )), - ), + // Padding( + // padding: const EdgeInsets.all(4), + // child: Container( + // height: Get.height * .25, + // decoration: AppStyle.boxDecoration1, + // child: Column( + // children: [ + // Text( + // '${'Total price from '.tr}${Get.find().passengerName}', + // style: AppStyle.title, + // ), + // Container( + // decoration: BoxDecoration( + // border: Border.all( + // width: 2, + // color: AppColor.greenColor, + // )), + // child: Padding( + // padding: const EdgeInsets.all(4), + // child: Text( + // Get.find() + // .totalPassenger, + // style: AppStyle.number, + // ), + // ), + // ), + // ], + // )), + // ), Center( child: RatingBar.builder( initialRating: 0, diff --git a/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart b/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart index 65c2293..d08743e 100644 --- a/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart +++ b/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart @@ -18,7 +18,7 @@ GetBuilder driverEndRideBar() { height: mapDriverController.remainingTimeTimerRideBegin < 60 ? mapDriverController.driverEndPage = 160 : 100, - width: 200, + width: 240, child: Column( children: [ Row( @@ -53,6 +53,14 @@ GetBuilder driverEndRideBar() { ), ], ), + Row( + children: [ + Text(mapDriverController.recentAngelToMarker + .toStringAsFixed(0)), + Text(mapDriverController.recentDistanceToDash + .toStringAsFixed(0)) + ], + ), mapDriverController.remainingTimeTimerRideBegin < 60 ? Row( mainAxisAlignment: MainAxisAlignment.center, diff --git a/lib/views/home/profile/passenger_profile_page.dart b/lib/views/home/profile/passenger_profile_page.dart index 2693e2f..f1699ef 100644 --- a/lib/views/home/profile/passenger_profile_page.dart +++ b/lib/views/home/profile/passenger_profile_page.dart @@ -320,15 +320,15 @@ class CountryPicker extends StatelessWidget { @override Widget build(BuildContext context) { return GetBuilder(builder: (controller) { - return Column( + return ListView( children: [ const SizedBox( height: 20, ), Text("Select Your Country".tr), - const SizedBox( - height: 20, - ), + // const SizedBox( + // height: 20, + // ), Padding( padding: const EdgeInsets.all(10), child: Text( @@ -336,7 +336,7 @@ class CountryPicker extends StatelessWidget { .tr), ), SizedBox( - height: 300, + height: 200, child: CupertinoPicker( itemExtent: 32, onSelectedItemChanged: (int index) {