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,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,
),
},
),
),
);
}
}