Releases: mapbox/mapbox-maps-flutter
v2.0.0-rc.1
Features ✨ and improvements 🏁
- [Android] Add Gradle 8 compatibility.
- Fixes race condition in events when method call to subscribe to map events from dart side was competing with early map events.
Dependency Updates
- Bump Mapbox Maps SDK to 11.4.0-rc.2
v2.0.0-beta.1
2.0.0-beta.1
Features ✨ and improvements 🏁
- Add a way to disable default puck's image(s) when using
DefaultLocationPuck2D
. By passing an empty byte array, for example, the following code shows a puck 2D with custom top image, default bearing image and no shadow image.
mapboxMap?.location.updateSettings(LocationComponentSettings(
enabled: true,
puckBearingEnabled: true,
locationPuck:
LocationPuck(locationPuck2D: DefaultLocationPuck2D(topImage: list, shadowImage: Uint8List.fromList([]))))
);
- Introduce experimental
RasterArraySource
, note thatrasterLayers
is a get-only property and cannot be set. - Introduce
TileCacheBudget
, a property to set per-source cache budgets in either megabytes or tiles. - Expose
iconColorSaturation
,rasterArrayBand
,rasterElevation
,rasterEmissiveStrength
,hillshadeEmissiveStrength
, andfillExtrusionEmissiveStrength
on their respective layers. - Mark
MapboxMapsOptions.get/setWorldview()
andMapboxMapsOptions.get/setLanguage()
as experimental.
Snapshots
Standalone snapshotter
Show multiple maps at the same time with no performance penalty. With the all new Snapshotter
you can get image snapshots of the map, styled the same way as MapWidget
.
The Snapshotter
class is highly configurable. You can set the final result at the time of construction using the MapSnapshotOptions
. Once you've configured your snapshot, you can start the snapshotting process.
One of the key features of the Snapshotter
class is the style
object. This object can be manipulated to set different styles for your snapshot, as well as to apply runtime styling to the style, giving you the flexibility to create a snapshot that fits your needs.
final snapshotter = await Snapshotter.create(
options: MapSnapshotOptions(
size: Size(width: 400, height: 400),
pixelRatio: MediaQuery.of(context).devicePixelRatio),
onStyleLoadedListener: (_) {
// apply runtime styling
final layer = CircleLayer(id: "circle-layer", sourceId: "poi-source");
snapshotter?.style.addLayer(layer);
},
);
snapshotter.style.setStyleURI(MapboxStyles.STANDARD);
snapshotter.setCamera(CameraOptions(center: Point(...)));
...
final snapshotImage = await snapshotter.start()
Map widget snapshotting
Create snapshots of the map displayed in the MapWidget
with MapboxMap.snapshot()
. This new feature allows you to capture a static image of the current map view.
The snapshot()
method captures the current state of the Mapbox map, including all visible layers, markers, and user interactions.
To use the snapshot() method, simply call it on your Mapbox map instance. The method will return a Future that resolves to the image of the current map view.
final snapshotImage = await mapboxMap.snapshot();
Please note that the snapshot()
method works best if the Mapbox Map is fully loaded before capturing an image. If the map is not fully loaded, the method might return a blank image.
⚠️ Breaking changes
Leveraging Turf's geometries as a replacement for Map<String, Any?>
You now have the convenience of directly initializing annotations with Turf's geometries, eliminating the need for converting geometry to JSON.
Geographical position represented by Point
s
Geographical positions denoted by Map<String?, Object?>?
are migrated to Point
type from turf package.
Pass Point
s directly instead of converting them to JSON.
Before:
CameraOptions(
center: Point(
coordinates: Position(
-0.11968,
51.50325,
)).toJson())
After:
CameraOptions(
center: Point(
coordinates: Position(
-0.11968,
51.50325,
)))
Screen and geographical positions in map interaction(gestures) callbacks
MapWidget
's onTapListener
/onLongTapListener
/onScrollListener
now receive MapContentGestureContext
containing both touch position of the gesture, as well as the projected map coordinate corresponding to the touch position.
Before:
onTapListener: { (coordinate)
final lat = coordinate.x;
final lng = coordinate.y;
...
}
After:
onTapListener: { (context)
final coordinates = context.point.coordinates; // Position
final touchPosition = context.touchPosition; // ScreenCoordinate
...
}
Creating an annotation with a given geometry
Before:
PointAnnotationOptions(
geometry: Point(
coordinates: Position(0.381457, 6.687337)
).toJson()
)
PolygonAnnotationOptions(
geometry: Polygon(coordinates: [
[
Position(-3.363937, -10.733102),
Position(1.754703, -19.716317),
Position(-15.747196, -21.085074),
Position(-3.363937, -10.733102)
]
]).toJson()
)
PolylineAnnotationOptions(
geometry: LineString(coordinates: [
Position(1.0, 2.0),
Position(10.0, 20.0)
]).toJson()
)
After:
PointAnnotationOptions(
geometry: Point(
coordinates: Position(0.381457, 6.687337)
)
)
PolygonAnnotationOptions(
geometry: Polygon(coordinates: [
[
Position(-3.363937, -10.733102),
Position(1.754703, -19.716317),
Position(-15.747196, -21.085074),
Position(-3.363937, -10.733102)
]
])
)
PolylineAnnotationOptions(
geometry: LineString(coordinates: [
Position(1.0, 2.0),
Position(10.0, 20.0)
])
)
Bug fixes 🐞
- [iOS] Fix crash in
onStyleImageMissingListener
. - Fix camera center not applied from map init options.
- [iOS] Free up resources upon map widget disposal. This should help to reduce the amount of used memory when previously shown map widget is removed from the widget tree.
- Fix multi-word enum cases decoding/encoding when being sent to/from the platform side.
Other Changes
- Deprecate
cameraForCoordinates
, please usecameraForCoordinatesPadding
instead.
Dependency Updates
- Bump Mapbox Maps SDK to 11.4.0-beta.2
- Bump Pigeon to 17.1.2
0.6.0
Note
This release contains fixes to the Privacy Manifest on iOS. Upgrade to avoid issues in the App Store app submission starting from May 1st.
Android
- Fix map being pixelated on some devices when ContextMode.SHARED is used (e.g. in AndroidAuto extension).
- Fix incorrect widget position and scale when resizing the drawing surface.
- Fix a crash in MapView.snapshot happening on specific devices.
iOS
- Fix the issue with invalid privacy manifest
1.1.0
- [Android] Fix
maps-lifecycle
plugin crash withjava.lang.IllegalStateException: Please ensure that the hosting activity/fragment is a valid LifecycleOwner
. - [Android] Fix
hasStyleImage()
method hanging. - [Android] Fix
getStyleImage()
method causing native exception. - [iOS] Fix crash in
onStyleImageMissingListener
. - Update MapboxMaps version to 11.3.0
1.1.0-rc.1
1.0.0-rc.1
Features ✨ and improvements 🏁
- Add
LogConfiguration
allowing to intercept logs produced by the plugin. Pass your customLogWriterBackend
toLogConfiguration.registerLogWriterBackend()
to redirect logs produced by the mapping engine to your desired destination. - Add
MapWidget.onResourceRequestListener
that can be used to subscribe to resource requests made by the map. - Bump platform Maps SDK dependencies to 11.2.0-rc.1.
Bug fixes🐞
- [iOS] Re-wire
MapWidget
'sonScroll
event to be triggered whenever map is being panned instead of triggering it only after pan ends. - [iOS] Address crashes on iOS happening when user location is being shown.
1.0.0-beta.3
Features ✨ and improvements 🏁
- Bump platform Maps SDK dependencies to 11.2.0-beta.1.
- Add an example representing a traffic route with color based on traffic volumes using LineLayer and Expression.
- [Android] Use hybrid composition(HC) as the default platform view hosting mode on Android.
- [Android] Add experimental
androidHostingMode
constructor parameter toMapWidget
. Use this to change the way platform MapView is being hosted by Flutter on Android. This changes the way map view is composited with Flutter UI, read more on this in Android Platform Views guide from the Flutter team. - [iOS]
MapboxMap
:isGestureInProgress()
,isUserAnimationInProgress()
,setConstrainMode()
,setNorthOrientation()
,setViewportMode()
andreduceMemoryUse()
are now available on iOS.
Bug fixes🐞
- [Android] Fix MapOptions incorrect index access at map creation, leading to map not being created(blank view).
1.0.0-beta.2
Features ✨ and improvements 🏁
- Bump platform Maps SDK dependencies to 11.1.0
- ✨ You can now specify custom
id
when creating an annotation manager, thisid
will be assigned to its backing layer and source. Additionally, you can control the position of the annotation's layer related to other style layers, for example:
final manager = await mapboxMap.annotations.createPointAnnotationManager(id: "annotation-layer-id", below: "other-layer-id");
- ✨ You can now use
DefaultLocationPuck2D
when updating location settings to use the default appearance of MapboxMaps location puck. - ✨ We have added
_AnnotationManager.removeAnnotationManagerById()
allowing to remove annotation manager by its id, without having to store a reference to the manager. - ✨Make padding parameter optional in MapboxMap.cameraForCoordinateBounds() and MapboxMap.cameraForCoordinates().
- Convert all
MapboxMapsOptions
setters and getters to be static methods. - Bump Pigeon to v16.0.0.
- Update minimum Flutter SDK version to
3.10.0
and minimum Dart SDK version to3.0.0
.
Bug fixes🐞
- [iOS] Fix point annotation image disappearing after update.
- [iOS] Fix 2D puck's opacity not being respected.
- [Android] Fix initial camera options passed to MapWidget not being applied.
1.0.0-beta.1
Features ✨ and improvements 🏁
- Bump platform Maps SDK dependencies to 11.0.0.