This commit is contained in:
Hamza-Ayed
2024-06-09 17:31:25 +03:00
parent 97c0b5d1bd
commit b5badb8f2e
13 changed files with 704 additions and 96 deletions

View File

@@ -16,11 +16,11 @@ import 'mapDriverWidgets/sos_connect.dart';
class PassengerLocationMapPage extends StatelessWidget {
PassengerLocationMapPage({super.key});
final LocationController locationController = Get.put(LocationController());
final MapDriverController mapDriverController =
Get.put(MapDriverController());
// final MapDriverController mapDriverController =
// Get.put(MapDriverController());
@override
Widget build(BuildContext context) {
// Get.put(MapDriverController());
Get.put(MapDriverController());
return MyScafolld(
title: 'Map Passenger'.tr,
@@ -31,7 +31,7 @@ class PassengerLocationMapPage extends StatelessWidget {
const SosConnect(),
speedCircle(),
const GoogleMapApp(),
PricesWindow(),
const PricesWindow(),
],
isleading: false);
}

View File

@@ -0,0 +1,92 @@
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/home/captin/speed_map_controller.dart';
import 'package:SEFER/views/home/Captin/mapDriverWidgets/speed_google_map.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/controller/home/captin/map_driver_controller.dart';
import 'package:SEFER/views/widgets/my_scafold.dart';
import '../../../controller/functions/location_controller.dart';
import '../../Rate/rate_passenger.dart';
import 'mapDriverWidgets/driver_end_ride_bar.dart';
import 'mapDriverWidgets/google_driver_map_page.dart';
import 'mapDriverWidgets/google_map_app.dart';
import 'mapDriverWidgets/passenger_info_window.dart';
import 'mapDriverWidgets/sos_connect.dart';
class DriverSpeedLocationMapPage extends StatelessWidget {
DriverSpeedLocationMapPage({super.key});
final LocationController locationController = Get.put(LocationController());
// final MapDriverController mapDriverController =
// Get.put(MapDriverController());
@override
Widget build(BuildContext context) {
Get.put(SpeedMapController())
.startTimerToShowPassengerInfoWindowFromDriver();
Get.find<SpeedMapController>().argumentLoading();
Get.put(MapDriverController());
return MyScafolld(
title: 'Map Passenger'.tr,
body: [
SpeedGoogleDriverMap(locationController: locationController),
const PassengerInfoWindow(),
driverEndRideBar(),
const SosConnect(),
speedCircle(),
const GoogleMapApp(),
const PricesWindow(),
],
isleading: false);
}
}
class PricesWindow extends StatelessWidget {
const PricesWindow({
super.key,
});
@override
Widget build(BuildContext context) {
return GetBuilder<MapDriverController>(builder: (mapDriverController) {
return mapDriverController.isPriceWindow
? Positioned(
bottom: Get.height * 1.2,
// top: Get.height * 3,
left: Get.height * 1,
right: Get.height * 1,
child: Container(
height: Get.height * 3,
decoration: AppStyle.boxDecoration1,
child: Column(
children: [
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(3),
child: Text(
'Total Price is '.tr,
style: AppStyle.headTitle2,
textAlign: TextAlign.center,
),
)),
const SizedBox(
height: 20,
),
MyElevatedButton(
title: 'ok'.tr,
onPressed: () =>
Get.to(() => RatePassenger(), arguments: {
'rideId': mapDriverController.rideId,
'passengerId': mapDriverController.passengerId,
'driverId': mapDriverController.driverId
}))
],
),
),
)
: const SizedBox();
});
}
}

View File

@@ -16,7 +16,7 @@ class GoogleDriverMap extends StatelessWidget {
@override
Widget build(BuildContext context) {
// Get.put(MapDriverController());
Get.put(MapDriverController());
return Padding(
padding: const EdgeInsets.all(8.0),
child: GetBuilder<MapDriverController>(
@@ -54,8 +54,8 @@ class GoogleDriverMap extends StatelessWidget {
visible: true,
polylineId: const PolylineId('route1'),
points: controller.polylineCoordinates,
color: AppColor.greenColor,
width: 3,
color: AppColor.yellowColor,
width: 4,
),
Polyline(
zIndex: 2,
@@ -67,7 +67,7 @@ class GoogleDriverMap extends StatelessWidget {
polylineId: const PolylineId('route'),
points: controller.polylineCoordinatesDestination,
color: AppColor.primaryColor,
width: 2,
width: 4,
),
},
markers: {
@@ -79,7 +79,7 @@ class GoogleDriverMap extends StatelessWidget {
rotation: locationController.heading),
Marker(
markerId: MarkerId('start'.tr),
position: controller.latLngpassengerLocation,
position: controller.latLngPassengerLocation,
draggable: true,
icon: controller.startIcon,
),

View File

@@ -21,10 +21,10 @@ class GoogleMapApp extends StatelessWidget {
child: IconButton(
onPressed: () async {
var startLat = Get.find<MapDriverController>()
.latLngpassengerLocation
.latLngPassengerLocation
.latitude;
var startLng = Get.find<MapDriverController>()
.latLngpassengerLocation
.latLngPassengerLocation
.longitude;
var endLat = Get.find<MapDriverController>()

View File

@@ -0,0 +1,97 @@
import 'package:SEFER/controller/home/captin/speed_map_controller.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import '../../../../constant/colors.dart';
import '../../../../controller/functions/location_controller.dart';
class SpeedGoogleDriverMap extends StatelessWidget {
const SpeedGoogleDriverMap({
super.key,
required this.locationController,
});
final LocationController locationController;
@override
Widget build(BuildContext context) {
Get.put(SpeedMapController());
return Padding(
padding: const EdgeInsets.all(8.0),
child: GetBuilder<SpeedMapController>(
builder: (controller) => GoogleMap(
onMapCreated: controller.onMapCreated,
initialCameraPosition: CameraPosition(
// bearing: 45,
target: locationController.myLocation,
zoom: 16,
tilt: 40,
),
onCameraMoveStarted: () {},
onCameraMove: (position) {
locationController.myLocation = position.target;
controller.mapController!
.animateCamera(CameraUpdate.newCameraPosition(position));
},
minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
myLocationEnabled: true,
compassEnabled: true,
mapType: MapType.normal,
trafficEnabled: true,
buildingsEnabled: true,
mapToolbarEnabled: true,
zoomControlsEnabled: true,
fortyFiveDegreeImageryEnabled: true,
zoomGesturesEnabled: true,
polylines: {
Polyline(
zIndex: 2,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('route1'),
points: controller.polylineCoordinates,
color: AppColor.yellowColor,
width: 4,
),
Polyline(
zIndex: 2,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('route'),
points: controller.polylineCoordinatesDestination,
color: AppColor.primaryColor,
width: 4,
),
},
markers: {
Marker(
markerId: MarkerId('MyLocation'.tr),
position: locationController.myLocation,
draggable: true,
icon: controller.carIcon,
rotation: locationController.heading),
Marker(
markerId: MarkerId('start'.tr),
position: controller.latLngPassengerLocation,
draggable: true,
icon: controller.startIcon,
),
Marker(
markerId: MarkerId('end'.tr),
position: controller.latLngPassengerDestination,
draggable: true,
icon: controller.endIcon,
),
},
),
),
);
}
}

View File

@@ -82,7 +82,7 @@ class OrderRequestPage extends StatelessWidget {
// orderRequestController.calculateConsumptionFuel();
return MyScafolld(
title: 'Order Details'.tr,
title: 'Special Order'.tr,
body: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 6),

View File

@@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:SEFER/controller/functions/tts.dart';
import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
import 'package:SEFER/views/home/Captin/driver_map_speed.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/box_name.dart';
@@ -90,7 +91,7 @@ class OrderSpeedRequest extends StatelessWidget {
// }
return MyScafolld(
title: 'Order Details'.tr,
title: 'Speed Order'.tr,
body: [
ListView(
// crossAxisAlignment: CrossAxisAlignment.start,
@@ -336,6 +337,7 @@ class OrderSpeedRequest extends StatelessWidget {
}));
} else if (jsonDecode(res)['status'] == "success") {
box.write(BoxName.statusDriverLocation, 'on');
orderRequestController.changeApplied();
List<String> bodyToPassenger = [
box.read(BoxName.driverID).toString(),
box.read(BoxName.nameDriver).toString(),
@@ -359,40 +361,75 @@ class OrderSpeedRequest extends StatelessWidget {
bodyToPassenger,
);
Get.back();
Get.to(() => PassengerLocationMapPage(), arguments: {
'passengerLocation': myList[0].toString(),
'passengerDestination': myList[1].toString(),
'Duration': myList[4].toString(),
'totalCost': myList[26].toString(),
'Distance': myList[5].toString(),
'name': myList[8].toString(),
'phone': myList[10].toString(),
'email': myList[28].toString(),
'WalletChecked': myList[13].toString(),
'tokenPassenger': myList[9].toString(),
'direction':
'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/',
'DurationToPassenger': myList[15].toString(),
'rideId': myList[16].toString(),
'passengerId': myList[7].toString(),
'driverId': myList[18].toString(),
'durationOfRideValue': myList[19].toString(),
'paymentAmount': myList[2].toString(),
'paymentMethod': myList[13].toString() == 'true'
? 'visa'
: 'cash',
'isHaveSteps': myList[20].toString(),
'step0': myList[21].toString(),
'step1': myList[22].toString(),
'step2': myList[23].toString(),
'step3': myList[24].toString(),
'step4': myList[25].toString(),
'passengerWalletBurc': myList[26].toString(),
'timeOfOrder': DateTime.now().toString(),
'totalPassenger': myList[2].toString(),
'carType': myList[31].toString(),
'kazan': myList[32].toString(),
});
print(
'Arguments passed to PassengerLocationMapPage:');
print('Passenger Location: ${myList[0]}');
print('Passenger Destination: ${myList[1]}');
print('Duration: ${myList[4]}');
print('Total Cost: ${myList[26]}');
print('Distance: ${myList[5]}');
print('Name: ${myList[8]}');
print('Phone: ${myList[10]}');
print('Email: ${myList[28]}');
print('Wallet Checked: ${myList[13]}');
print('Token Passenger: ${myList[9]}');
print('Direction: ${myList[29]}');
print('Duration To Passenger: ${myList[15]}');
print('Ride ID: ${myList[16]}');
print('Passenger ID: ${myList[7]}');
print('Driver ID: ${myList[18]}');
print('Duration Of Ride Value: ${myList[19]}');
print('Payment Amount: ${myList[2]}');
print(
'Payment Method: ${myList[13] == 'true' ? 'visa' : 'cash'}');
print('Is Have Steps: ${myList[20]}');
print('Step 0: ${myList[21]}');
print('Step 1: ${myList[22]}');
print('Step 2: ${myList[23]}');
print('Step 3: ${myList[24]}');
print('Step 4: ${myList[25]}');
print('Passenger Wallet Burc: ${myList[26]}');
print('Time Of Order: ${myList[30]}');
print('Total Passenger: ${myList[2]}');
print('Car Type: ${myList[31]}');
print('Kazan: ${myList[32]}');
Get.to(() => DriverSpeedLocationMapPage(),
arguments: {
'passengerLocation': myList[0].toString(),
'passengerDestination': myList[1].toString(),
'Duration': myList[4].toString(),
'totalCost': myList[26].toString(),
'Distance': myList[5].toString(),
'name': myList[8].toString(),
'phone': myList[10].toString(),
'email': myList[28].toString(),
'WalletChecked': myList[13].toString(),
'tokenPassenger': myList[9].toString(),
'direction':
'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/',
'DurationToPassenger': myList[15].toString(),
'rideId': myList[16].toString(),
'passengerId': myList[7].toString(),
'driverId': myList[18].toString(),
'durationOfRideValue': myList[19].toString(),
'paymentAmount': myList[2].toString(),
'paymentMethod': myList[13].toString() == 'true'
? 'visa'
: 'cash',
'isHaveSteps': myList[20].toString(),
'step0': myList[21].toString(),
'step1': myList[22].toString(),
'step2': myList[23].toString(),
'step3': myList[24].toString(),
'step4': myList[25].toString(),
'passengerWalletBurc': myList[26].toString(),
'timeOfOrder': DateTime.now().toString(),
'totalPassenger': myList[2].toString(),
'carType': myList[31].toString(),
'kazan': myList[32].toString(),
});
}
// });
// Get.back();