mapbox / mapbox/mapbox-maps-flutter

[BUG] Resuming the app does not repaint and leaves the map black

Open
#1,140 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.