From c5ac5c2b22e7b820f8be941215ffc4a27cd59de6 Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Mon, 6 May 2024 13:30:09 +0300 Subject: [PATCH] 5/6/1 --- android/app/build.gradle | 4 +- lib/controller/auth/login_controller.dart | 1 - .../home/map_passenger_controller.dart | 18 ++- lib/controller/local/translations.dart | 36 +++++ lib/views/auth/login_page.dart | 4 - lib/views/home/HomePage/about_page.dart | 101 ++++++++++++ .../HomePage/frequentlyQuestionsPage.dart | 147 ++++++++++++++++++ lib/views/home/home_page.dart | 22 +++ lib/views/home/map_page_passenger.dart | 9 +- .../car_details_widget_to_go.dart | 72 +++++++-- .../form_search_places_destenation.dart | 53 ++++++- .../map_widget.dart/left_main_menu_icons.dart | 48 +++--- .../map_widget.dart/main_bottom_Menu_map.dart | 2 +- .../home/map_widget.dart/map_menu_widget.dart | 25 ++- .../home/map_widget.dart/menu_map_page.dart | 2 +- 15 files changed, 489 insertions(+), 55 deletions(-) create mode 100644 lib/views/home/HomePage/about_page.dart create mode 100644 lib/views/home/HomePage/frequentlyQuestionsPage.dart diff --git a/android/app/build.gradle b/android/app/build.gradle index 0acbdc8..c2ea6ce 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -55,8 +55,8 @@ android { // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdkVersion 23 targetSdkVersion flutter.targetSdkVersion - versionCode 22 - versionName '1.4.6' + versionCode 25 + versionName '1.4.8' // manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml'] } diff --git a/lib/controller/auth/login_controller.dart b/lib/controller/auth/login_controller.dart index 10f64a3..6a033ac 100644 --- a/lib/controller/auth/login_controller.dart +++ b/lib/controller/auth/login_controller.dart @@ -12,7 +12,6 @@ import 'package:SEFER/main.dart'; import 'package:SEFER/views/auth/verify_email_page.dart'; import 'package:SEFER/views/home/map_page_passenger.dart'; import 'package:location/location.dart'; -// import 'package:permission_handler/permission_handler.dart'; class LoginController extends GetxController { final formKey = GlobalKey(); diff --git a/lib/controller/home/map_passenger_controller.dart b/lib/controller/home/map_passenger_controller.dart index 19a1452..84dce82 100644 --- a/lib/controller/home/map_passenger_controller.dart +++ b/lib/controller/home/map_passenger_controller.dart @@ -57,7 +57,7 @@ class MapPassengerController extends GetxController { List wayPoint2 = []; List wayPoint3 = []; List wayPoint4 = []; - final textToSpeechController = Get.put(TextToSpeechController()); + List> placeListResponseAll = []; List placeListResponse = [ @@ -846,6 +846,8 @@ class MapPassengerController extends GetxController { children: [ IconButton( onPressed: () async { + final textToSpeechController = + Get.find(); await textToSpeechController.speakText(midTitle); }, icon: const Icon(Icons.headphones)), @@ -1090,6 +1092,7 @@ class MapPassengerController extends GetxController { startTimerFromDriverToPassengerAfterApplied(); // startTimer(); } else if (res.toString() == 'Refused') { + statusRide = 'Refused'; // isDriversTokensSend = false; if (isDriversTokensSend == false) { confirmRideForAllDriverAvailable(); @@ -1434,6 +1437,10 @@ class MapPassengerController extends GetxController { isMarkersShown = false; haveSteps = false; isMarkersShown = false; + driverToken = ''; + driverId = ''; + driverPhone = ''; + driverName = ''; // totalStepDurations = 0; timeToPassengerFromDriverAfterApplied = 0; remainingTime = 0; @@ -1454,6 +1461,10 @@ class MapPassengerController extends GetxController { isWayPointStopsSheetUtilGetMap = false; rideConfirm = false; shouldFetch = false; + driverToken = ''; + driverId = ''; + driverPhone = ''; + driverName = ''; isCashConfirmPageShown = false; isSearchingWindow = false; isPassengerChosen = false; @@ -2517,7 +2528,8 @@ class MapPassengerController extends GetxController { late List recentPlaces = []; getFavioratePlaces() async { - recentPlaces = await sql.getAllData(TableName.recentLocations); + recentPlaces = await sql.getCustomQuery( + 'SELECT DISTINCT latitude, longitude, name, rate FROM ${TableName.recentLocations}'); } double passengerRate = 5; @@ -2571,7 +2583,7 @@ class MapPassengerController extends GetxController { await getPassengerRate(); await getRideStatusFromStartApp(); startMarkerReloading(); - + Get.put(TextToSpeechController()); // await getNearestDriverByPassengerLocation(); initilizeGetStorage(); diff --git a/lib/controller/local/translations.dart b/lib/controller/local/translations.dart index 96236b3..a2f570b 100644 --- a/lib/controller/local/translations.dart +++ b/lib/controller/local/translations.dart @@ -4,8 +4,44 @@ class MyTranslation extends Translations { @override Map> get keys => { "ar": { + 'How do I request a ride?': 'كيف يمكنني طلب رحلة؟', + 'Step-by-step instructions on how to request a ride through the Sefer app.': + 'تعليمات خطوة بخطوة حول كيفية طلب رحلة من خلال تطبيق Sefer.', + 'What types of vehicles are available?': + 'ما هي أنواع السيارات المتاحة؟', + 'Sefer offers a variety of vehicle options to suit your needs, including economy, comfort, and luxury. Choose the option that best fits your budget and passenger count.': + 'يقدم Sefer مجموعة متنوعة من خيارات السيارات لتناسب احتياجاتك، بما في ذلك الاقتصادية والراحة والفخامة. اختر الخيار الذي يناسب ميزانيتك وعدد الركاب بشكل أفضل.', + 'How can I pay for my ride?': 'كيف يمكنني الدفع لرحلتي؟', + 'Sefer offers multiple payment methods for your convenience. Choose between cash payment or credit/debit card payment during ride confirmation.': + 'يقدم Sefer طرق دفع متعددة لراحتك. اختر بين الدفع النقدي أو الدفع ببطاقة الائتمان/الخصم أثناء تأكيد الرحلة.', + 'Can I cancel my ride?': 'هل يمكنني إلغاء رحلتي؟', + 'Yes, you can cancel your ride under certain conditions (e.g., before driver is assigned). See the Sefer cancellation policy for details.': + 'نعم، يمكنك إلغاء رحلتك في ظل ظروف معينة (على سبيل المثال، قبل تعيين السائق). اطلع على سياسة إلغاء Sefer لمزيد من التفاصيل.', + 'Driver Registration & Requirements': 'تسجيل السائق والمتطلبات', + 'How can I register as a driver?': 'كيف يمكنني التسجيل كسائق؟', + 'What are the requirements to become a driver?': + 'ما هي الشروط لتصبح سائق؟', + 'Visit our website or contact Sefer support for information on driver registration and requirements.': + 'قم بزيارة موقعنا على الويب أو اتصل بدعم Sefer للحصول على معلومات حول تسجيل السائق والمتطلبات.', + 'How do I communicate with the other party (passenger/driver)?': + 'كيف يمكنني التواصل مع الطرف الآخر (الراكب/السائق)؟', + 'Sefer provides in-app chat functionality to allow you to communicate with your driver or passenger during your ride.': + 'يوفر Sefer وظيفة الدردشة داخل التطبيق للسماح لك بالتواصل مع سائقك أو راكبك أثناء رحلتك.', + 'What safety measures does Sefer offer?': + 'ما هي التدابير الأمنية التي يقدمها Sefer؟', + 'Sefer prioritizes your safety. We offer features like driver verification, in-app trip tracking, and emergency contact options.': + 'يعمل Sefer على أولوية سلامتك. نحن نقدم ميزات مثل التحقق من السائق، وتتبع الرحلة داخل التطبيق، وخيارات الاتصال بالطوارئ.', + '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 فيما يلي بعض الميزات الرئيسية التي تميزنا:", "Choose Language": "اخْتَر اللُّغَة", "Login": "تَسْجِيل الدُّخُول", + '\nWe also prioritize affordability, offering competitive pricing to make your rides accessible.': + "\nكما نضع في اعتبار القدرة على تحمل التكاليف ، ونقدم أسعارًا تنافسية لجعل رحلاتك في متناول الجميع.", + 'Most Secure Methods': 'أساليب الأمان الأكثر', + 'In-App VOIP Calls': 'مكالمات VOIP داخل التطبيق', + 'Recorded Trips for Safety': 'تسجيل الرحلات من أجل السلامة', "Pay with Wallet": 'ادْفَع بِاسْتِخْدَام المَحْفَظَة', "Invalid MPIN": 'رَمْز PIN غَيْر صَحِيح', "Invalid OTP": 'كود التَّحَقُّق خَاطِئ', diff --git a/lib/views/auth/login_page.dart b/lib/views/auth/login_page.dart index 7dce305..52c6c2b 100644 --- a/lib/views/auth/login_page.dart +++ b/lib/views/auth/login_page.dart @@ -9,10 +9,6 @@ import 'package:SEFER/constant/style.dart'; import 'package:SEFER/main.dart'; import 'package:SEFER/views/widgets/elevated_btn.dart'; import 'package:SEFER/views/widgets/my_scafold.dart'; -import 'package:SEFER/views/widgets/my_textField.dart'; -import 'package:location/location.dart'; -import 'package:permission_handler/permission_handler.dart'; -// import 'package:permission_handler/permission_handler.dart'; import '../../constant/info.dart'; import '../../controller/auth/login_controller.dart'; diff --git a/lib/views/home/HomePage/about_page.dart b/lib/views/home/HomePage/about_page.dart new file mode 100644 index 0000000..99347f8 --- /dev/null +++ b/lib/views/home/HomePage/about_page.dart @@ -0,0 +1,101 @@ +import 'package:SEFER/constant/box_name.dart'; +import 'package:SEFER/constant/style.dart'; +import 'package:SEFER/main.dart'; +import 'package:SEFER/views/widgets/my_scafold.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +class AboutPage extends StatelessWidget { + const AboutPage({super.key}); + + @override + Widget build(BuildContext context) { + return MyScafolld( + title: 'About Us'.tr, + body: [ + // Company Logo (consider adding an image asset) + ListView( + children: [ + Center( + child: Image.asset( + 'assets/images/logo.png', // Replace with your logo image asset path + height: 100.0, + width: 100.0, + ), + ), // Company Name and Location + Padding( + padding: const EdgeInsets.all(16.0), + child: Text( + 'SEFER LLC\n${box.read(BoxName.countryCode).toString().tr}', + style: AppStyle.headTitle2, + textAlign: TextAlign.center, + ), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: Text( + '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:' + .tr, + style: AppStyle.title, + textAlign: TextAlign.center, + ), + ), // Security Features List + const SizedBox( + height: 20, + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 24.0), + child: Column( + children: [ + Row( + children: [ + const Icon(Icons.lock, color: Colors.blue), + const SizedBox(width: 8.0), + Text( + 'Most Secure Methods'.tr, + style: AppStyle.title, + ), + ], + ), + const SizedBox(height: 8.0), + Row( + children: [ + const Icon(Icons.phone, color: Colors.blue), + const SizedBox(width: 8.0), + Text( + 'In-App VOIP Calls'.tr, + style: AppStyle.title, + ), + ], + ), + const SizedBox(height: 8.0), + Row( + children: [ + const Icon(Icons.videocam, color: Colors.blue), + const SizedBox(width: 8.0), + Text( + 'Recorded Trips for Safety'.tr, + style: AppStyle.title, + ), + ], + ), + ], + ), + ), // Affordability Highlight + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: Text( + '\nWe also prioritize affordability, offering competitive pricing to make your rides accessible.' + .tr, + style: AppStyle.title, + textAlign: TextAlign.center, + ), + ), + ], + ), + + // About Us Text + ], + isleading: true); + } +} diff --git a/lib/views/home/HomePage/frequentlyQuestionsPage.dart b/lib/views/home/HomePage/frequentlyQuestionsPage.dart new file mode 100644 index 0000000..7252133 --- /dev/null +++ b/lib/views/home/HomePage/frequentlyQuestionsPage.dart @@ -0,0 +1,147 @@ +import 'package:SEFER/controller/home/map_passenger_controller.dart'; +import 'package:SEFER/views/widgets/my_scafold.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +import '../../../constant/style.dart'; + +class FrequentlyQuestionsPage extends StatelessWidget { + const FrequentlyQuestionsPage({super.key}); + + @override + Widget build(BuildContext context) { + String selectedPayment = 'cash'; // Replace with your initial selection + bool canCancelRide = false; + return MyScafolld( + title: 'Frequently Questions'.tr, + body: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: ListView( + children: [ + // Question 1: How do I request a ride? + ExpansionTile( + title: Text( + 'How do I request a ride?'.tr, + style: AppStyle.title, + ), + children: [ + Text( + 'Step-by-step instructions on how to request a ride through the Sefer app.' + .tr, + style: AppStyle.title, + ), + ], + ), + + // Question 2: What types of vehicles are available? + ExpansionTile( + title: Text( + 'What types of vehicles are available?'.tr, + style: AppStyle.title, + ), + children: [ + Text( + 'Sefer offers a variety of vehicle options to suit your needs, including economy, comfort, and luxury. Choose the option that best fits your budget and passenger count.' + .tr, + style: AppStyle.title, + ), + ], + ), + + // Question 3: How can I pay for my ride? + ExpansionTile( + title: Text( + 'How can I pay for my ride?'.tr, + style: AppStyle.title, + ), + children: [ + Text( + 'Sefer offers multiple payment methods for your convenience. Choose between cash payment or credit/debit card payment during ride confirmation.' + .tr, + style: AppStyle.title, + ), + ], + ), + + // Question 4: Can I cancel my ride? (if applicable) + ExpansionTile( + title: Text( + 'Can I cancel my ride?'.tr, + style: AppStyle.title, + ), + children: [ + Text( + 'Yes, you can cancel your ride under certain conditions (e.g., before driver is assigned). See the Sefer cancellation policy for details.' + .tr, + style: AppStyle.title, + ), + ], + ), + + // Question 5 & 6: Driver-specific questions + ExpansionTile( + title: Text( + 'Driver Registration & Requirements'.tr, + style: AppStyle.title, + ), + children: [ + Text( + '${'How can I register as a driver?'.tr}\n${'What are the requirements to become a driver?'.tr}', + style: AppStyle.title, + ), + InkWell( + onTap: () { + Get.find() + .getDialog('title', 'midTitle', () { + print( + 'dd'); //todo add in this dialog papers for driver + }); + }, + child: Text( + 'Visit our website or contact Sefer support for information on driver registration and requirements.' + .tr, + style: AppStyle.title, + ), + ), + ], + ), + + // Question 7: How do I communicate with the other party? + ExpansionTile( + title: Text( + 'How do I communicate with the other party (passenger/driver)?' + .tr, + style: AppStyle.title, + ), + children: [ + Text( + 'Sefer provides in-app chat functionality to allow you to communicate with your driver or passenger during your ride.' + .tr, + style: AppStyle.title, + ), + ], + ), + + // Question 8: What safety measures does Sefer offer? + ExpansionTile( + title: Text( + 'What safety measures does Sefer offer?'.tr, + style: AppStyle.title, + ), + children: [ + Text( + 'Sefer prioritizes your safety. We offer features like driver verification, in-app trip tracking, and emergency contact options.' + .tr, + style: AppStyle.title, + ), + ], + ), + ], + ), + ) + ], + isleading: true); + } +} diff --git a/lib/views/home/home_page.dart b/lib/views/home/home_page.dart index 52aeaca..8f46102 100644 --- a/lib/views/home/home_page.dart +++ b/lib/views/home/home_page.dart @@ -10,6 +10,8 @@ import 'package:path/path.dart' as path; import 'package:share/share.dart'; import '../../controller/functions/audio_record1.dart'; +import 'HomePage/about_page.dart'; +import 'HomePage/frequentlyQuestionsPage.dart'; import 'profile/passenger_profile_page.dart'; class HomePage extends StatelessWidget { @@ -55,6 +57,16 @@ class HomePage extends StatelessWidget { body: [CountryPickerFromSetting()], isleading: true)), ), + ListTile( + leading: const Icon(Icons.question_answer), + title: Text( + 'Frequently questions'.tr, + style: AppStyle.headTitle2, + ), + subtitle: + Text('You can change the Country to get all features'.tr), + onTap: () => Get.to(() => const FrequentlyQuestionsPage()), + ), ListTile( leading: const Icon(Icons.record_voice_over_outlined), title: Text( @@ -179,6 +191,16 @@ class HomePage extends StatelessWidget { }), ); }), + ListTile( + leading: const Icon(Icons.account_balance_outlined), + title: Text( + 'About Us'.tr, + style: AppStyle.headTitle2, + ), + subtitle: + Text('You can change the Country to get all features'.tr), + onTap: () => Get.to(() => const AboutPage()), + ), ], ), ], diff --git a/lib/views/home/map_page_passenger.dart b/lib/views/home/map_page_passenger.dart index 2eb290c..77d966c 100644 --- a/lib/views/home/map_page_passenger.dart +++ b/lib/views/home/map_page_passenger.dart @@ -42,10 +42,10 @@ class MapPagePassenger extends StatelessWidget { const MainBottomMenuMap(), // NewMainBottomSheet(), const MapMenuWidget(), - const MenuIconMapPageWidget(), buttomSheetMapPage(), CarDetailsTypeToChoose(), - const Burc(), + const HeaderDestination(), + const BurcMoney(), const ApplyOrderWidget(), // hexagonClipper(), const CancelRidePageShow(), @@ -55,10 +55,11 @@ class MapPagePassenger extends StatelessWidget { // timerForCancelTripFromPassenger(), // const DriverTimeArrivePassengerPage(), // const TimerToPassengerFromDriver(), - PassengerRideLocationWidget(), + const PassengerRideLocationWidget(), const RideBeginPassenger(), const RideFromStartApp(), cancelRidePage(), + const MenuIconMapPageWidget(), PointsPageForRider() ], ), @@ -82,7 +83,7 @@ class CancelRidePageShow extends StatelessWidget { ? Positioned( right: box.read(BoxName.lang) != 'ar' ? 10 : null, left: box.read(BoxName.lang) == 'ar' ? 10 : null, - top: 30, + top: Get.height * .013, child: GestureDetector( onTap: () { controller.changeCancelRidePageShow(); diff --git a/lib/views/home/map_widget.dart/car_details_widget_to_go.dart b/lib/views/home/map_widget.dart/car_details_widget_to_go.dart index 785d2f9..7972ea3 100644 --- a/lib/views/home/map_widget.dart/car_details_widget_to_go.dart +++ b/lib/views/home/map_widget.dart/car_details_widget_to_go.dart @@ -54,13 +54,7 @@ class CarDetailsTypeToChoose extends StatelessWidget { left: 5, right: 5, child: Container( - decoration: const BoxDecoration( - color: Color.fromARGB(255, 255, 255, 255), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - topRight: Radius.circular(8), - ), - ), + decoration: AppStyle.boxDecoration1, height: Get.height * .4, child: Column( children: [ @@ -406,8 +400,8 @@ class CarDetailsTypeToChoose extends StatelessWidget { } } -class Burc extends StatelessWidget { - const Burc({super.key}); +class BurcMoney extends StatelessWidget { + const BurcMoney({super.key}); @override Widget build(BuildContext context) { @@ -467,6 +461,66 @@ class Burc extends StatelessWidget { } } +class HeaderDestination extends StatelessWidget { + const HeaderDestination({super.key}); + + @override + Widget build(BuildContext context) { + return GetBuilder( + builder: (mapPassengerController) { + return mapPassengerController.data.isNotEmpty && + mapPassengerController.isBottomSheetShown && + mapPassengerController.rideConfirm == false + ? Positioned( + top: Get.height * .1, + left: 5, + right: 5, + child: Container( + decoration: AppStyle.boxDecoration1, + height: Get.height * .16, + width: Get.width * .8, + child: InkWell( + onTap: () { + mapPassengerController + .getDialog('Are you want to change'.tr, '', () { + Get.back(); + mapPassengerController.cancelRide(); + }); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text( + '🤢 ${mapPassengerController.startNameAddress}', + style: AppStyle.subtitle, + ), + Text( + '😡 ${mapPassengerController.endNameAddress}', + style: AppStyle.subtitle, + ), + Row( + children: [ + Text( + '📍 ${mapPassengerController.distance} ${'KM'.tr} ⌛ ${mapPassengerController.hours > 0 ? '${'Your Ride Duration is '.tr}${mapPassengerController.hours} ${'H and'.tr} ${mapPassengerController.minutes} ${'m'.tr}' : '${'Your Ride Duration is '.tr} ${mapPassengerController.minutes} m'}', + style: AppStyle.subtitle, + ), + ], + ), + ], + ), + ), + ), + ), + ) + : const SizedBox(); + }, + ); + } +} + class CarDialogue extends StatelessWidget { const CarDialogue({ super.key, diff --git a/lib/views/home/map_widget.dart/form_search_places_destenation.dart b/lib/views/home/map_widget.dart/form_search_places_destenation.dart index e0a2447..d4d1606 100644 --- a/lib/views/home/map_widget.dart/form_search_places_destenation.dart +++ b/lib/views/home/map_widget.dart/form_search_places_destenation.dart @@ -110,7 +110,26 @@ GetBuilder formSearchPlacesDestenation() { box.read(BoxName.addWork).split(',')[1]), ); print(latLng); - controller.newMyLocation = latLng; + controller.newMyLocation = + controller.newStartPointLocation; + controller.changeMainBottomMenuMap(); + + controller.getMap( + '${controller.passengerLocation.latitude},${controller.passengerLocation.longitude}', + '${latLng.latitude},${latLng.longitude}', + ); + controller.currentLocationToFormPlaces = false; + controller.placesDestination = []; + // controller.isCancelRidePageShown = true; + controller.clearPlacesStart(); + controller.clearPlacesDestination(); + controller.passengerStartLocationFromMap = + false; + controller.isPickerShown = false; + // controller.showBottomSheet1(); + // Get.back(); + controller.showBottomSheet1(); + // controller.newMyLocation = latLng; controller.update(); } }, @@ -128,11 +147,16 @@ GetBuilder formSearchPlacesDestenation() { })); }, child: Container( + width: Get.width * .25, decoration: BoxDecoration( color: AppColor.greenColor.withOpacity(.4), border: Border.all()), child: Text( - '${'Work :'.tr} ${box.read(BoxName.addWork).toString() == 'addWork' ? 'Add Work' : box.read(BoxName.addWork).toString().split(',')[0] + box.read(BoxName.addWork).toString().split(',')[1]} '), + ' ${box.read(BoxName.addWork)}' == 'addWork' + ? 'Add Work' + : 'Work', + textAlign: TextAlign.center, + ), ), ), InkWell( @@ -165,16 +189,37 @@ GetBuilder formSearchPlacesDestenation() { box.read(BoxName.addHome).split(',')[1]), ); print(latLng); - controller.newMyLocation = latLng; + controller.changeMainBottomMenuMap(); + + // controller.newMyLocation = latLng; + controller.getMap( + '${controller.passengerLocation.latitude},${controller.passengerLocation.longitude}', + '${latLng.latitude},${latLng.longitude}', + ); + controller.currentLocationToFormPlaces = false; + controller.placesDestination = []; + // controller.isCancelRidePageShown = true; + controller.clearPlacesStart(); + controller.clearPlacesDestination(); + controller.passengerStartLocationFromMap = + false; + controller.isPickerShown = false; + // controller.showBottomSheet1(); + // Get.back(); + controller.showBottomSheet1(); + // controller.newMyLocation = latLng; + controller.update(); controller.update(); } }, child: Container( + width: Get.width * .25, decoration: BoxDecoration( color: AppColor.yellowColor.withOpacity(.4), border: Border.all()), child: Text( - 'Home : ${box.read(BoxName.addHome) == 'addHome' ? 'Add Home' : box.read(BoxName.addHome)} '), + textAlign: TextAlign.center, + '${box.read(BoxName.addHome) == 'addHome' ? 'Add Home' : 'Home'} '), ), ), ], diff --git a/lib/views/home/map_widget.dart/left_main_menu_icons.dart b/lib/views/home/map_widget.dart/left_main_menu_icons.dart index 1b1661e..fa09a7a 100644 --- a/lib/views/home/map_widget.dart/left_main_menu_icons.dart +++ b/lib/views/home/map_widget.dart/left_main_menu_icons.dart @@ -1,5 +1,7 @@ import 'package:SEFER/constant/style.dart'; +import 'package:SEFER/constant/table_names.dart'; import 'package:SEFER/controller/functions/crud.dart'; +import 'package:SEFER/main.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; @@ -15,10 +17,10 @@ GetBuilder leftMainMenuIcons() { final textToSpeechController = Get.put(TextToSpeechController()); return GetBuilder( builder: (controller) => Positioned( - top: 85, - left: 6, + top: Get.height * .008, + left: Get.width * .2, child: Builder(builder: (context) { - return Column( + return Row( children: [ AnimatedContainer( duration: const Duration(microseconds: 200), @@ -39,7 +41,7 @@ GetBuilder leftMainMenuIcons() { ), ), const SizedBox( - height: 5, + width: 5, ), AnimatedContainer( duration: const Duration(microseconds: 200), @@ -60,7 +62,7 @@ GetBuilder leftMainMenuIcons() { ), ), const SizedBox( - height: 5, + width: 5, ), // if (Platform.isIOS) AnimatedContainer( @@ -84,25 +86,25 @@ GetBuilder leftMainMenuIcons() { ), ), const SizedBox( - height: 5, + width: 5, + ), + AnimatedContainer( + duration: const Duration(microseconds: 200), + width: controller.widthMapTypeAndTraffic, + decoration: BoxDecoration( + color: AppColor.secondaryColor, + border: Border.all(), + borderRadius: BorderRadius.circular(15)), + child: IconButton( + onPressed: () async { + sql.deleteAllData(TableName.recentLocations); + }, + icon: const Icon( + Icons.voice_chat, + size: 29, + ), + ), ), - // AnimatedContainer( - // duration: const Duration(microseconds: 200), - // width: controller.widthMapTypeAndTraffic, - // decoration: BoxDecoration( - // color: AppColor.secondaryColor, - // border: Border.all(), - // borderRadius: BorderRadius.circular(15)), - // child: IconButton( - // onPressed: () async { - // await Get.find().stopRecording(); - // }, - // icon: const Icon( - // Icons.voice_chat, - // size: 29, - // ), - // ), - // ), // AnimatedContainer( // duration: const Duration(microseconds: 200), // width: controller.widthMapTypeAndTraffic, diff --git a/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart b/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart index 121248c..7cebae4 100644 --- a/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart +++ b/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart @@ -145,7 +145,7 @@ class MainBottomMenuMap extends StatelessWidget { SizedBox recentPlacesWidget(MapPassengerController controller) { final textToSpeechController = Get.put(TextToSpeechController()); return SizedBox( - height: 50, + height: controller.recentPlaces.isEmpty ? 0 : 50, child: ListView.builder( itemCount: controller.recentPlaces.length, scrollDirection: Axis.horizontal, diff --git a/lib/views/home/map_widget.dart/map_menu_widget.dart b/lib/views/home/map_widget.dart/map_menu_widget.dart index 9dd8fa1..3c675a7 100644 --- a/lib/views/home/map_widget.dart/map_menu_widget.dart +++ b/lib/views/home/map_widget.dart/map_menu_widget.dart @@ -1,3 +1,6 @@ +import 'dart:io'; + +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_font_icons/flutter_font_icons.dart'; import 'package:get/get.dart'; @@ -8,6 +11,7 @@ import 'package:SEFER/views/home/profile/feed_back_page.dart'; import 'package:SEFER/views/home/profile/order_history.dart'; import 'package:SEFER/views/home/profile/promos_passenger_page.dart'; import 'package:SEFER/views/home/profile/taarif_page.dart'; +import 'package:url_launcher/url_launcher.dart'; import '../../../constant/colors.dart'; import '../../../controller/home/map_passenger_controller.dart'; @@ -160,9 +164,24 @@ class MapMenuWidget extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ IconMainPageMap( - onTap: () { - // Get.to(const RegisterCaptin()); - //todo use url to use driver app + onTap: () async { + final String driverAppUrl; + if (defaultTargetPlatform == TargetPlatform.android) { + driverAppUrl = + 'https://play.google.com/store/apps/details?id=id6458734951'; // Replace with your driver app's Play Store URL + } else if (defaultTargetPlatform == TargetPlatform.iOS) { + driverAppUrl = + 'https://apps.apple.com/app/id6458734951'; // Replace with your driver app's App Store ID + } else { + // Handle other platforms or unknown platform (optional) + return; + } + + if (await canLaunch(driverAppUrl)) { + await launch(driverAppUrl); + } else { + throw 'Could not launch app store URL'; + } }, title: 'Driver'.tr, icon: WeatherIcons.wi_moon_14, diff --git a/lib/views/home/map_widget.dart/menu_map_page.dart b/lib/views/home/map_widget.dart/menu_map_page.dart index 32d8dea..9d8cbe6 100644 --- a/lib/views/home/map_widget.dart/menu_map_page.dart +++ b/lib/views/home/map_widget.dart/menu_map_page.dart @@ -15,7 +15,7 @@ class MenuIconMapPageWidget extends StatelessWidget { Widget build(BuildContext context) { return GetBuilder( builder: (controller) => Positioned( - top: 30, + top: Get.height * .008, left: box.read(BoxName.lang) != 'ar' ? 5 : null, right: box.read(BoxName.lang) == 'ar' ? 5 : null, child: Container(