Search code examples
flutterfullscreenflutter-desktop

How to make flutter desktop app goes fullscreen when move to top of the screen


When I move my app to the top of the screen enter image description here

I want to make it look like this and then file explorer goes fullscreen enter image description here


Solution

  • you can use windows_manager package. add this code to your main.dart:

    import 'package:flutter/material.dart';
    import 'package:window_manager/window_manager.dart';
    
    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.setTitleBarStyle(TitleBarStyle.hidden);
        await windowManager.setSize(Size(800, 600));
        await windowManager.center();
        await windowManager.show();
        await windowManager.setSkipTaskbar(false);
      });
    
      runApp(MyApp());
    }