bitsdojo / bitsdojo_window

A Flutter package that makes it easy to customize and work with your Flutter desktop app window.
http://www.youtube.com/watch?v=bee2AHQpGK4
MIT License
815 stars 229 forks source link

Start app with window maximized properly #96

Open marcov-dart opened 3 years ago

marcov-dart commented 3 years ago

Is there a way to start an app with the window maximized properly?

Putting win.maximize() in doWhenWindowReady sortof works. You can add it either before or after win.show(), but in either case it doesn't really start out maximized and you can see the window resize a few times.

When I am not using bitsdojo_window I can edit win32_window.cpp and add WS_MAXIMIZE to CreateWindow and that works fine. Then app properly starts with the window maximized. But together with bitsdojo_window adding WS_MAXIMIZE to CreateWindow creates weird behaviour. The window starts with the given size in doWhenWindowReady. Pressing the maximize button once makes it bigger, but not maximized. Then only after pressing the button again does it become maximized.

bitsdojo commented 3 years ago

Thanks for reporting this. Added to my list.

ngugcx commented 2 years ago

Hi, any update for this issue?

  doWhenWindowReady(() {
    const initialSize = Size(1200, 800);
    appWindow.size = initialSize;
    appWindow.minSize = const Size(800, 600);
    appWindow.title = gAppName;
    appWindow.maximize();
    appWindow.show();
  });

I want to make my app maximized on startup. It can be done as above, put "appWindow.maximize();" before "appWindow.show();". But it looks like the window size changs twice, the first one is bigger than the screen, then the second is maximized.

flutter: 3.3.0 bitsdojo_window: 0.1.2