diff --git a/lib/controller/home/captin/order_request_controller.dart b/lib/controller/home/captin/order_request_controller.dart index c390765..62725dc 100644 --- a/lib/controller/home/captin/order_request_controller.dart +++ b/lib/controller/home/captin/order_request_controller.dart @@ -11,7 +11,7 @@ import '../../functions/crud.dart'; class OrderRequestController extends GetxController { double progress = 0; - int duration = 25; + int duration = 15; int remainingTime = 0; String countRefuse = '0'; bool applied = false; @@ -84,6 +84,7 @@ class OrderRequestController extends GetxController { void refuseOrder(String driverID, orderID) async { await CRUD().postFromDialogue(link: AppLink.addDriverOrder, payload: { + //TODO need review 'driver_id': box.read(BoxName.driverID).toString(), // box.read(BoxName.driverID).toString(), 'order_id': orderID, diff --git a/lib/views/home/map_page_passenger.dart b/lib/views/home/map_page_passenger.dart index edc710b..18ac3c6 100644 --- a/lib/views/home/map_page_passenger.dart +++ b/lib/views/home/map_page_passenger.dart @@ -1,18 +1,15 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:ride/constant/colors.dart'; -import 'package:ride/constant/style.dart'; import 'package:ride/controller/home/map_passenger_controller.dart'; import 'package:ride/views/home/map_widget.dart/cancel_raide_page.dart'; import 'package:ride/views/home/map_widget.dart/ride_begin_passenger.dart'; -import 'package:ride/views/widgets/elevated_btn.dart'; -import 'package:ride/views/widgets/mycircular.dart'; import '../../controller/home/menu_controller.dart'; import 'map_widget.dart/buttom_sheet_map_show.dart'; import 'map_widget.dart/cash_confirm_bottom_page.dart'; import 'map_widget.dart/driver_card_from_passenger.dart'; +import 'map_widget.dart/google_map_passenger_widget.dart'; import 'map_widget.dart/left_main_menu_icons.dart'; import 'map_widget.dart/main_bottom_Menu_map.dart'; import 'map_widget.dart/map_menu_widget.dart'; @@ -32,240 +29,7 @@ class MapPagePassenger extends StatelessWidget { body: SafeArea( child: Stack( children: [ - GetBuilder( - builder: (controller) => controller.isLoading - ? const MyCircularProgressIndicator() - : GoogleMap( - onMapCreated: controller.onMapCreated, - cameraTargetBounds: - CameraTargetBounds(controller.boundsdata), - minMaxZoomPreference: const MinMaxZoomPreference(6, 18), - onLongPress: (argument) { - Get.defaultDialog( - title: 'Are you want to go to this site'.tr, - content: Column( - children: [ - Text( - '${argument.latitude},${argument.longitude}'), - ], - ), - confirm: MyElevatedButton( - title: 'Ok'.tr, - onPressed: () async { - controller.clearPolyline(); - if (controller.dataCarsLocationByPassenger != - null) { - await controller.getMap( - '${controller.myLocation.latitude},${controller.myLocation.longitude}', - '${argument.latitude.toString()},${argument.longitude.toString()}'); - - Get.back(); - controller.bottomSheet(); - controller.showBottomSheet1(); - } else { - Get.back(); - Get.snackbar( - 'We Are Sorry That we dont have cars in your Location!' - .tr, - 'message', - colorText: AppColor.redColor, - duration: const Duration(seconds: 11), - instantInit: true, - snackPosition: SnackPosition.TOP, - titleText: Text( - 'Error'.tr, - style: const TextStyle( - color: AppColor.redColor), - ), - messageText: Text( - 'We Are Sorry That we dont have cars in your Location!' - .tr, - style: AppStyle.title, - ), - icon: const Icon(Icons.error), - shouldIconPulse: true, - maxWidth: double.infinity, - margin: const EdgeInsets.all(16), - padding: const EdgeInsets.all(16), - borderRadius: 8, - borderColor: AppColor.redColor, - borderWidth: 2, - backgroundColor: AppColor.secondaryColor, - leftBarIndicatorColor: AppColor.redColor, - boxShadows: [ - BoxShadow( - color: Colors.black.withOpacity(0.25), - blurRadius: 4, - spreadRadius: 2, - offset: const Offset(0, 4), - ), - ], - backgroundGradient: const LinearGradient( - colors: [ - AppColor.redColor, - AppColor.accentColor - ], - begin: Alignment.topLeft, - end: Alignment.bottomRight, - ), - // mainButton: TextButton( - // onPressed: () { - // controller.getCarsLocationByPassenger(); - // }, - // child: Text( - // 'Try Again'.tr, - // style: const TextStyle( - // color: AppColor.secondaryColor), - // ), - // ), - onTap: (GetSnackBar snackBar) { - // Do something when the snackbar is tapped. - }, - isDismissible: true, - showProgressIndicator: false, - dismissDirection: DismissDirection.up, - progressIndicatorController: null, - progressIndicatorBackgroundColor: - Colors.transparent, - progressIndicatorValueColor: null, - snackStyle: SnackStyle.GROUNDED, - forwardAnimationCurve: - Curves.easeInToLinear, - reverseAnimationCurve: Curves.easeInOut, - animationDuration: - const Duration(milliseconds: 4000), - barBlur: 8, - overlayBlur: 0, - snackbarStatus: null, - overlayColor: - AppColor.primaryColor.withOpacity(0.5), - userInputForm: null, - ); - } - - // - }), - ); - }, - - onTap: (argument) { - controller.hidePlaces(); - - // controller.changeBottomSheetShown(); - // controller.bottomSheet(); - }, - initialCameraPosition: CameraPosition( - target: controller.myLocation, - zoom: 15, - ), - markers: { - for (var carLocation - in controller.carsLocationByPassenger) - Marker( - // anchor: const Offset(4, 4), - position: carLocation, - icon: controller.carIcon, - markerId: MarkerId(carLocation.toString())), - for (var carLocation in controller - .driverCarsLocationToPassengerAfterApplied) - Marker( - // anchor: const Offset(4, 4), - position: carLocation, - icon: controller.carIcon, - markerId: MarkerId(carLocation.toString())), - Marker( - markerId: MarkerId('MyLocation'.tr), - position: controller.myLocation, - draggable: true, - icon: controller.markerIcon, - infoWindow: const InfoWindow( - title: 'Time', - // snippet: controller.durationFromDriverToPassenger - // .toString(), - ), - onDragEnd: (value) { - print(value); - }, - // infoWindow: InfoWindow(title: 'my location'.tr), - ), - // Marker( - // markerId: MarkerId('Target'.tr), - // position: controller.myDestination, - // draggable: true, - // onDragEnd: (v) { - // print(v); - // }, - // ), - }, - polylines: { - Polyline( - zIndex: 2, - consumeTapEvents: true, - geodesic: true, - endCap: Cap.buttCap, - startCap: Cap.buttCap, - visible: true, - polylineId: const PolylineId('route'), - points: controller.polylineCoordinates, - color: AppColor.primaryColor, - width: 5, - ), - // Polyline( - // zIndex: 2, - // consumeTapEvents: true, - // geodesic: true, - // endCap: Cap.buttCap, - // startCap: Cap.buttCap, - // visible: true, - // polylineId: PolylineId('g'), - // points: [ - // LatLng(controller.southwest.latitude, - // controller.southwest.longitude), - // LatLng(controller.northeast.latitude, - // controller.northeast.longitude) - // ], - // color: AppColor.primaryColor, - // width: 5, - // ), - }, - // circles: { - // Circle( - // circleId: const CircleId('kk'), - // center: controller.mylocation, - // radius: 60, - // fillColor: AppColor.primaryColor,) - // }, - - circles: { - Circle( - circleId: const CircleId('circle_id'), - center: controller.myLocation, - radius: 100, - fillColor: Colors.blue.withOpacity(0.3), - strokeColor: Colors.blue, - strokeWidth: 2, - ), - }, - - mapType: controller.mapType - ? MapType.satellite - : MapType.normal, - myLocationButtonEnabled: true, - // liteModeEnabled: true, tiltGesturesEnabled: false, - - // indoorViewEnabled: true, - trafficEnabled: controller.mapTrafficON, - buildingsEnabled: true, - mapToolbarEnabled: true, - onCameraMove: (position) { - controller.newMyLocation = position.target; - // print('my' + controller.mylocation.toString()); - // print('new' + controller.newMylocation.toString()); - }, - myLocationEnabled: true, - // liteModeEnabled: true, - ), - ), + const GoogleMapPassengerWidget(), leftMainMenuIcons(), const PickerIconOnMap(), // PickerAnimtionContainerFormPlaces(), @@ -274,7 +38,6 @@ class MapPagePassenger extends StatelessWidget { const MenuIconMapPageWidget(), buttomSheetMapPage(), hexagonClipper(), - const CancelRidePageShow(), const CashConfirmPageShown(), const PaymentMethodPage(), diff --git a/lib/views/home/map_widget.dart/google_map_passenger_widget.dart b/lib/views/home/map_widget.dart/google_map_passenger_widget.dart new file mode 100644 index 0000000..8213601 --- /dev/null +++ b/lib/views/home/map_widget.dart/google_map_passenger_widget.dart @@ -0,0 +1,242 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; + +import '../../../constant/colors.dart'; +import '../../../constant/style.dart'; +import '../../../controller/home/map_passenger_controller.dart'; +import '../../widgets/elevated_btn.dart'; +import '../../widgets/mycircular.dart'; + +class GoogleMapPassengerWidget extends StatelessWidget { + const GoogleMapPassengerWidget({ + super.key, + }); + + @override + Widget build(BuildContext context) { + return GetBuilder( + builder: (controller) => controller.isLoading + ? const MyCircularProgressIndicator() + : GoogleMap( + onMapCreated: controller.onMapCreated, + cameraTargetBounds: CameraTargetBounds(controller.boundsdata), + minMaxZoomPreference: const MinMaxZoomPreference(6, 18), + onLongPress: (argument) { + Get.defaultDialog( + title: 'Are you want to go to this site'.tr, + content: Column( + children: [ + Text('${argument.latitude},${argument.longitude}'), + ], + ), + confirm: MyElevatedButton( + title: 'Ok'.tr, + onPressed: () async { + controller.clearPolyline(); + if (controller.dataCarsLocationByPassenger != null) { + await controller.getMap( + '${controller.myLocation.latitude},${controller.myLocation.longitude}', + '${argument.latitude.toString()},${argument.longitude.toString()}'); + + Get.back(); + controller.bottomSheet(); + controller.showBottomSheet1(); + } else { + Get.back(); + Get.snackbar( + 'We Are Sorry That we dont have cars in your Location!' + .tr, + 'message', + colorText: AppColor.redColor, + duration: const Duration(seconds: 11), + instantInit: true, + snackPosition: SnackPosition.TOP, + titleText: Text( + 'Error'.tr, + style: const TextStyle(color: AppColor.redColor), + ), + messageText: Text( + 'We Are Sorry That we dont have cars in your Location!' + .tr, + style: AppStyle.title, + ), + icon: const Icon(Icons.error), + shouldIconPulse: true, + maxWidth: double.infinity, + margin: const EdgeInsets.all(16), + padding: const EdgeInsets.all(16), + borderRadius: 8, + borderColor: AppColor.redColor, + borderWidth: 2, + backgroundColor: AppColor.secondaryColor, + leftBarIndicatorColor: AppColor.redColor, + boxShadows: [ + BoxShadow( + color: Colors.black.withOpacity(0.25), + blurRadius: 4, + spreadRadius: 2, + offset: const Offset(0, 4), + ), + ], + backgroundGradient: const LinearGradient( + colors: [AppColor.redColor, AppColor.accentColor], + begin: Alignment.topLeft, + end: Alignment.bottomRight, + ), + // mainButton: TextButton( + // onPressed: () { + // controller.getCarsLocationByPassenger(); + // }, + // child: Text( + // 'Try Again'.tr, + // style: const TextStyle( + // color: AppColor.secondaryColor), + // ), + // ), + onTap: (GetSnackBar snackBar) { + // Do something when the snackbar is tapped. + }, + isDismissible: true, + showProgressIndicator: false, + dismissDirection: DismissDirection.up, + progressIndicatorController: null, + progressIndicatorBackgroundColor: + Colors.transparent, + progressIndicatorValueColor: null, + snackStyle: SnackStyle.GROUNDED, + forwardAnimationCurve: Curves.easeInToLinear, + reverseAnimationCurve: Curves.easeInOut, + animationDuration: + const Duration(milliseconds: 4000), + barBlur: 8, + overlayBlur: 0, + snackbarStatus: null, + overlayColor: + AppColor.primaryColor.withOpacity(0.5), + userInputForm: null, + ); + } + + // + }), + ); + }, + + onTap: (argument) { + controller.hidePlaces(); + + // controller.changeBottomSheetShown(); + // controller.bottomSheet(); + }, + initialCameraPosition: CameraPosition( + target: controller.myLocation, + zoom: 15, + ), + markers: { + for (var carLocation in controller.carsLocationByPassenger) + Marker( + // anchor: const Offset(4, 4), + position: carLocation, + icon: controller.carIcon, + markerId: MarkerId(carLocation.toString())), + for (var carLocation + in controller.driverCarsLocationToPassengerAfterApplied) + Marker( + // anchor: const Offset(4, 4), + position: carLocation, + icon: controller.carIcon, + markerId: MarkerId(carLocation.toString())), + Marker( + markerId: MarkerId('MyLocation'.tr), + position: controller.myLocation, + draggable: true, + icon: controller.markerIcon, + infoWindow: const InfoWindow( + title: 'Time', + // snippet: controller.durationFromDriverToPassenger + // .toString(), + ), + onDragEnd: (value) { + print(value); + }, + // infoWindow: InfoWindow(title: 'my location'.tr), + ), + // Marker( + // markerId: MarkerId('Target'.tr), + // position: controller.myDestination, + // draggable: true, + // onDragEnd: (v) { + // print(v); + // }, + // ), + }, + polylines: { + Polyline( + zIndex: 2, + consumeTapEvents: true, + geodesic: true, + endCap: Cap.buttCap, + startCap: Cap.buttCap, + visible: true, + polylineId: const PolylineId('route'), + points: controller.polylineCoordinates, + color: AppColor.primaryColor, + width: 5, + ), + // Polyline( + // zIndex: 2, + // consumeTapEvents: true, + // geodesic: true, + // endCap: Cap.buttCap, + // startCap: Cap.buttCap, + // visible: true, + // polylineId: PolylineId('g'), + // points: [ + // LatLng(controller.southwest.latitude, + // controller.southwest.longitude), + // LatLng(controller.northeast.latitude, + // controller.northeast.longitude) + // ], + // color: AppColor.primaryColor, + // width: 5, + // ), + }, + // circles: { + // Circle( + // circleId: const CircleId('kk'), + // center: controller.mylocation, + // radius: 60, + // fillColor: AppColor.primaryColor,) + // }, + + circles: { + Circle( + circleId: const CircleId('circle_id'), + center: controller.myLocation, + radius: 100, + fillColor: Colors.blue.withOpacity(0.3), + strokeColor: Colors.blue, + strokeWidth: 2, + ), + }, + + mapType: controller.mapType ? MapType.satellite : MapType.normal, + myLocationButtonEnabled: true, + // liteModeEnabled: true, tiltGesturesEnabled: false, + + // indoorViewEnabled: true, + trafficEnabled: controller.mapTrafficON, + buildingsEnabled: true, + mapToolbarEnabled: true, + onCameraMove: (position) { + controller.newMyLocation = position.target; + // print('my' + controller.mylocation.toString()); + // print('new' + controller.newMylocation.toString()); + }, + myLocationEnabled: true, + // liteModeEnabled: true, + ), + ); + } +} diff --git a/lib/views/orderCaptin/order_request_page.dart b/lib/views/orderCaptin/order_request_page.dart index 418641c..6617361 100644 --- a/lib/views/orderCaptin/order_request_page.dart +++ b/lib/views/orderCaptin/order_request_page.dart @@ -243,7 +243,7 @@ class OrderRequestPage extends StatelessWidget { FirebaseMessagesController() .sendNotificationToPassengerToken( 'Refused Ride', - arguments['DriverList'][9].toString(), + '${box.read(BoxName.nameDriver)} rejct your order.', arguments['DriverList'][9].toString(), // box.read(BoxName.tokenDriver).toString(), bodyToPassenger,