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'; import '../../../../controller/home/captin/map_driver_controller.dart'; class GoogleDriverMap extends StatelessWidget { const GoogleDriverMap({ super.key, required this.locationController, }); final LocationController locationController; @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.all(8.0), child: GetBuilder( builder: (controller) => GoogleMap( onMapCreated: controller.onMapCreated, initialCameraPosition: CameraPosition( // bearing: 45, target: locationController.myLocation, zoom: 15, tilt: 40, ), onCameraMove: (position) { locationController.myLocation = position.target; print(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.greenColor, width: 3, ), 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: 2, ), }, markers: { Marker( markerId: MarkerId('MyLocation'.tr), position: locationController.myLocation, draggable: true, icon: controller.carIcon, ), 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, ), }, ), ), ); } }