This commit is contained in:
Hamza-Ayed
2023-10-03 16:00:33 +03:00
parent ca59d9e3b7
commit edc3a4348d
12 changed files with 238 additions and 105 deletions

View File

@@ -67,37 +67,27 @@ class TimerToPassengerFromDriver extends StatelessWidget {
? MyElevatedButton(
title: 'If you in Car Now. Press Start The Ride',
onPressed: () async {
MapController mapController =
Get.find<MapController>();
final firebasMessagesController =
Get.put(FirebasMessagesController());
//todo start the trip and rest all counter ,start new counter of the trip time
await CRUD()
.post(link: AppLink.updateRides, payload: {
'id': mapController.rideId,
'id': controller.rideId,
'rideTimeStart': DateTime.now().toString(),
'status': 'Applied'
});
mapController.driverArrivePassenger();
controller.driverArrivePassenger();
// Send notification to driver to alert him that trip is begin
firebasMessagesController
FirebaseMessagesController()
.sendNotificationToDriverId(
'Ride Begin',
'BeginTrip',
box.read(BoxName.name).toString(),
mapController
.dataCarsLocationByPassenger['message'][0]
['token']
.toString(),
);
print(mapController
.dataCarsLocationByPassenger['message'][0]
['token']
.toString());
Get.snackbar(
'The Ride is Begin'.tr,
'',
backgroundColor: AppColor.greenColor,
controller.driverToken.toString(),
);
print(controller.driverToken.toString());
// Get.defaultDialog(
// title: 'The Ride is Begin'.tr,
// backgroundColor: AppColor.greenColor,
// );
})
: const SizedBox()
],

View File

@@ -178,7 +178,7 @@ class OrderRequestPage extends StatelessWidget {
box.read(BoxName.tokenDriver).toString(),
];
// print(bodyToPassenger);
FirebasMessagesController()
FirebaseMessagesController()
.sendNotificanToPassengerToken(
'Apply Ride',
arguments['DriverList'][9].toString(),
@@ -187,7 +187,9 @@ class OrderRequestPage extends StatelessWidget {
bodyToPassenger,
);
Get.back();
Get.to(() => PassengerLocationDirection());
Get.to(() => PassengerLocationDirection(), arguments: {
'passengerLocation': myList[0].toString(),
});
},
),
GetBuilder<OrderRequestController>(
@@ -222,7 +224,7 @@ class OrderRequestPage extends StatelessWidget {
orderRequestController.refuseOrder(
myList[6].toString(), body.toString());
FirebasMessagesController()
FirebaseMessagesController()
.sendNotificanToPassengerToken(
'Refused Ride',
arguments['DriverList'][9].toString(),

View File

@@ -4,30 +4,65 @@ import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:ride/controller/home/captin/map_dirction.dart';
import 'package:ride/views/widgets/my_scafold.dart';
import '../../constant/colors.dart';
import '../../controller/functions/location_controller.dart';
import '../widgets/mycircular.dart';
import '../home/map_widget.dart/passenger_info_window.dart';
import '../home/map_widget.dart/timer_to_passenger_from_driver.dart';
class PassengerLocationDirection extends StatelessWidget {
PassengerLocationDirection({super.key});
// final LocationController locationController = Get.put(LocationController());
// final MapDirection mapDirection = Get.find<MapDirection>();
final LocationController locationController = Get.put(LocationController());
@override
Widget build(BuildContext context) {
Get.put(LocationController());
Get.put(MapDirection());
// mapDirection.getMap();//todo get this argument
return MyScafolld(
title: 'Map'.tr,
body: [
Padding(
padding: const EdgeInsets.all(8.0),
child: GetBuilder<LocationController>(
builder: (controller) => GoogleMap(
initialCameraPosition: CameraPosition(
target: controller.myLocation,
zoom: 15,
),
)),
)
child: GetBuilder<MapDirection>(
builder: (controller) => GoogleMap(
initialCameraPosition: CameraPosition(
target: locationController.myLocation,
zoom: 15,
),
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.greenColor,
width: 5,
),
},
markers: {
Marker(
markerId: MarkerId('MyLocation'.tr),
position: locationController.myLocation,
draggable: true,
icon: controller.carIcon,
infoWindow: const InfoWindow(
title: 'Time',
// snippet: controller.durationFromDriverToPassenger
// .toString(),
),
),
},
onCameraMove: (cameraPosition) {
controller.updateMarker();
},
),
),
),
// const TimerToPassengerFromDriver(),
const PassengerInfoWindow()
],
isleading: true);
}