From 33f5f27eaa36313cbea895bf4b89ae040bb991bf Mon Sep 17 00:00:00 2001 From: vypq Date: Mon, 14 Apr 2025 15:35:47 +0700 Subject: [PATCH] update --- lib/product/services/map_services.dart | 34 ++++++++++++++------------ pubspec.yaml | 2 +- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/product/services/map_services.dart b/lib/product/services/map_services.dart index 241324a..8b4d01d 100644 --- a/lib/product/services/map_services.dart +++ b/lib/product/services/map_services.dart @@ -43,22 +43,24 @@ class MapServices { List 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 []; - // } - 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 []; + } } } \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 258f450..6812bda 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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"