This commit is contained in:
Hamza-Ayed
2023-10-18 19:23:04 +03:00
parent b0e842e53b
commit 5cbd03f7d8
10 changed files with 122 additions and 13 deletions

View File

@@ -0,0 +1,66 @@
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<MapDriverController>(
builder: (controller) => GoogleMap(
onMapCreated: controller.onMapCreated,
initialCameraPosition: CameraPosition(
target: locationController.myLocation,
zoom: 15,
),
// onCameraMove: (position) {
// locationController.myLocation = position.target;
// print(position);
// },
minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
buildingsEnabled: true,
mapToolbarEnabled: true,
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(),
),
),
},
),
),
);
}
}