Files
tripz/lib/views/home/Captin/mapDriverWidgets/google_driver_map_page.dart
Hamza-Ayed e3a63e18fc 1/1/1
2024-01-01 00:56:25 +03:00

79 lines
2.4 KiB
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';
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,
),
Polyline(
zIndex: 2,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('route'),
points: controller.polylineCoordinatesDestination,
color: AppColor.redColor,
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(),
),
),
},
),
),
);
}
}