4

Is there a way to use fullscreen window mode in Flame 1.1.0 (under Windows Desktop)? There is no Util class from version 1.0.0 any more and the Flame.device.fullScreen(); call does not work, no matter where I call it.

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Flame.device.fullScreen();

  final game = MyGame();
  runApp(GameWidget(game: game));
}
Christian
  • 576
  • 1
  • 4
  • 16

1 Answers1

2

There is no built-in fullscreen window mode in Flutter yet (thus not in Flame either).

You can however use third-party libraries like window_manager to achieve fullscreen in windows.

Add this to your package's pubspec.yaml file:

dependencies:
  window_manager: ^0.2.1

Usage

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  // Must add this line.
  await windowManager.ensureInitialized();

  // Use it only after calling `hiddenWindowAtLaunch`
  windowManager.waitUntilReadyToShow().then((_) async{
    // Hide window title bar
    await windowManager.setFullscreen(true);
  });

  final game = MyGame();
  runApp(GameWidget(game: game));
}

spydon
  • 9,372
  • 6
  • 33
  • 63