mapbox / mapbox/mapbox-maps-flutter
Can't focus on puck on iOS
- Dominant language
- Dart
- Stars
- 380
- Forks
- 204
- PR merge metrics
- No merged PRs in 30d
Description
Per the example and my own implementation, I can't find a way to focus on the user's location or focus the camera on the puck. a
The current implementation in the example for getPuckPosition doesn't work on iOS, anyone have any knowledge on a work around for this as I'm getting this error:
`Exception has occurred.
PlatformException (PlatformException(StyleError(rawValue: "Layer puck is not in style"), null, null, null))`
I read through the other issues reported around this so trying to find a work around for the time being
but I'm just using the default styling:
```
extension PuckPosition on StyleManager {
Future getPuckPosition() async {
Layer? layer;
if (Platform.isAndroid) {
layer = await getLayer("mapbox-location-indicator-layer");
} else {
layer = await getLayer("puck");
}
final location = (layer as LocationIndicatorLayer).location;
return Future.value(Position(location![1]!, location[0]!));
}
}
```
Contributor guide
Research direction
Start with the example's getPuckPosition extension and reproduce the iOS PlatformException stating that the puck layer is not in the style. Check how the default iOS puck layer is exposed before attempting camera focus. Done means the example can locate the user's puck and focus the camera on it without the StyleError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter, ios
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100