Skip to content

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

Description

@LorenzSchueler

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions