mapbox / mapbox/mapbox-maps-flutter
[BUG] Resuming the app does not repaint and leaves the map black
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 380
- Forks
- 204
- PR merge metrics
- No merged PRs in 30d
Description
Steps to reproduce:
1. show a map
2. leave the app (e.g. switch to another app or lock the screen)
3. come back to the app
Problem:
The map stays black and is not redrawn. (Interacting with it triggers a redraw and it is shown again.)
Workaround:
Call `triggerRepaint()` in the `onResume` callback of `AppLivecycleListener`:
```
@override
void initState() {
super.initState();
_lifecycleListener = AppLifecycleListener(
onResume: () => WidgetsBinding.instance.addPostFrameCallback(
(_) => _mapController?.triggerRepaint(),
),
);
}
```
Versions:
- Flutter: `3.44.8`
- mapbox_maps_flutter: `2.27.0`
- Android: `17`
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 by reproducing the black map after backgrounding and resuming the app, then inspect the AppLifecycleListener onResume path and the map controller's triggerRepaint entry point. Done means the map redraws on resume without user interaction, covering the reported Flutter, plugin, and Android versions where appropriate.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100