overlayBuilderMap property

Map<String, OverlayWidgetBuilder<T>>? overlayBuilderMap
final

A collection of widgets that can be displayed over the game's surface. These widgets can be turned on-and-off dynamically from within the game via the Game.overlays property.

void main() {
  runApp(
    GameWidget(
      game: MyGame(),
      overlayBuilderMap: {
        'PauseMenu': (context, game) {
          return Container(
            color: const Color(0xFF000000),
            child: Text('A pause menu'),
          );
        },
      },
    ),
  );
}

Implementation

final Map<String, OverlayWidgetBuilder<T>>? overlayBuilderMap;