From 919e8ed34650ce3022651f5c13a5ddea13ece001 Mon Sep 17 00:00:00 2001 From: luis Date: Thu, 1 Jul 2021 18:19:22 +0200 Subject: [PATCH] feat: Take snapshots of the map Also fixes memory leak issue of apple_maps_flutter --- CHANGELOG.md | 5 +++++ example/android/.project | 28 ++++++++++++++++++++++++++++ example/android/app/.project | 28 ++++++++++++++++++++++++++++ lib/src/controller.dart | 9 +++++++++ pubspec.yaml | 4 ++-- 5 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 example/android/.project create mode 100644 example/android/app/.project diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e557eb..031d4f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.0.2 + +* Updates apple_maps_flutter to apply memory leak fix +* makes it possible to take snapshots of the map + ## 1.0.1 * Adds `newLatLngBounds` to PlatformMapController diff --git a/example/android/.project b/example/android/.project new file mode 100644 index 0000000..fc26fbf --- /dev/null +++ b/example/android/.project @@ -0,0 +1,28 @@ + + + android + Project android created by Buildship. + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.buildship.core.gradleprojectnature + + + + 1602529678411 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/example/android/app/.project b/example/android/app/.project new file mode 100644 index 0000000..e61e479 --- /dev/null +++ b/example/android/app/.project @@ -0,0 +1,28 @@ + + + app + Project app created by Buildship. + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.buildship.core.gradleprojectnature + + + + 1602529678416 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/lib/src/controller.dart b/lib/src/controller.dart index 553ba46..66c10de 100644 --- a/lib/src/controller.dart +++ b/lib/src/controller.dart @@ -109,4 +109,13 @@ class PlatformMapController { } return _bounds; } + + /// Returns the image bytes of the map + Future takeSnapshot() async { + if (Platform.isIOS) { + return this.appleController!.takeSnapshot(); + } else if (Platform.isAndroid) { + return this.googleController!.takeSnapshot(); + } + } } diff --git a/pubspec.yaml b/pubspec.yaml index 72f497c..123d161 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: platform_maps_flutter description: A Flutter package that combines google_maps and apple_maps to provide a crossplatform native map implementation. -version: 1.0.1 +version: 1.0.2 homepage: https://github.com/LuisThein repository: https://github.com/LuisThein/platform_maps_flutter issue_tracker: https://github.com/LuisThein/platform_maps_flutter/issues @@ -14,7 +14,7 @@ dependencies: google_maps_flutter: ^2.0.1 google_maps_flutter_platform_interface: ^2.0.3 - apple_maps_flutter: ^1.0.0 + apple_maps_flutter: ^1.0.1 dev_dependencies: flutter_test: