Search code examples
flutterscrollviewflame

how to create a scrollView in Flutter Flame


I need a listView for my Game. Is there a simple way to create one? There are no tutorials for such a feature and I couldn't find anything in the documentation.


Solution

  • Flame doesn't provide their own widgets for these things, we rely on Flutters excellent widget system.

    So you create the widget directly in Flutter and then you either put your GameWidget in a stack (or similar) and use Flutter's own Navigation to move between the widgets, or you use Flame's overlay system.

    For using the overlays you add the overlays that you want to have accessible when you create the GameWidget and then you call game.overlays.add to render a specific widget, and game.overlays.remove to stop rendering it.