mapbox / mapbox/mapbox-maps-flutter
Can not add image to the Snaphotter
Open
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 380
- Forks
- 204
- PR merge metrics
- No merged PRs in 30d
Description
This code works with MapBox controller object but when Snapshotter is used, marker is not drawn on the map.
Future<void> _addMarker() async {
final bytes = await rootBundle.load(Assets.image.mapPin.keyName);
final list = bytes.buffer.asUint8List();
await _snapshotter?.style.addStyleImage(
'icon',
1,
MbxImage(width: 10, height: 10, data: list),
true,
[],
[],
null,
);
final geometry = {
'type': 'Point',
'coordinates': [
widget.coordinates.longitude,
widget.coordinates.latitude,
],
};
final data = {'type': 'Feature', 'geometry': geometry};
final source = {'type': 'geojson', 'data': data};
await _snapshotter?.style
.addStyleSource('point_source', json.encode(source));
final symbolLayer = SymbolLayer(
id: 'point',
sourceId: 'point_source',
symbolPlacement: SymbolPlacement.POINT,
iconAllowOverlap: true,
iconAnchor: IconAnchor.BOTTOM_LEFT,
iconImage: 'icon',
iconColor: Colors.amber.value,
iconSize: 1,
);
await _snapshotter?.style.addLayer(symbolLayer);
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the _addMarker entry point and compare the Snapshotter.style image, source, and layer sequence with the working MapBox controller path described in the issue. Reproduce the supplied example and verify that the marker image is registered and drawn on the snapshot; done means the marker appears when Snapshotter is used.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100