This commit is contained in:
2025-04-14 15:35:47 +07:00
parent 84f10271e9
commit 33f5f27eaa
2 changed files with 19 additions and 17 deletions

View File

@@ -43,22 +43,24 @@ class MapServices {
List<LatLng> polylineCoordinates = [];
PolylinePoints polylinePoints = PolylinePoints();
// PolylineResult result = await polylinePoints.getRouteBetweenCoordinates(
// ApplicationConstants.MAP_KEY,
// PointLatLng(origin.latitude, origin.longitude),
// PointLatLng(destination.latitude, destination.longitude),
// travelMode: TravelMode.driving,
// optimizeWaypoints: true);
// if (result.points.isNotEmpty) {
// for (var point in result.points) {
// polylineCoordinates.add(LatLng(point.latitude, point.longitude));
// }
// return polylineCoordinates;
// } else {
// log("Lỗi khi tìm đường");
// return [];
// }
PolylineResult result = await polylinePoints.getRouteBetweenCoordinates(
googleApiKey: ApplicationConstants.MAP_KEY,
request: PolylineRequest(
origin: PointLatLng(origin.latitude, origin.longitude),
destination: PointLatLng(destination.latitude, destination.longitude),
mode: TravelMode.driving,
optimizeWaypoints: true
)
);
if (result.points.isNotEmpty) {
for (var point in result.points) {
polylineCoordinates.add(LatLng(point.latitude, point.longitude));
}
return polylineCoordinates;
} else {
log("Lỗi khi tìm đường");
return [];
}
}
}

View File

@@ -3,7 +3,7 @@ description: Smart Fire Monitoring
publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 1.0.5+5
version: 1.0.6+6
environment:
sdk: ">=3.0.1 <4.0.0"