8

I am trying to build a desktop app with flutter. I want to display the app window half the size of screen when login screen of the app is visible.

Is there a way to change the size of the App window programmatically? Actually I am new to dart and flutter Please help me, I can't find a way to do it.

Rahul Singh
  • 195
  • 2
  • 2
  • 13
  • Flutter for desktop app development is still in early stages and in technical preview. Which OS are you developing for? This is the [recent update](https://medium.com/flutter/flutter-and-desktop-3a0dd0f8353e) about ongoing development work in flutter desktop. – dev-aentgs Jun 24 '20 at 09:21
  • 1
    I was developing for MacOS. – Rahul Singh Jun 24 '20 at 10:47
  • 1
    Found [this](https://stackoverflow.com/questions/61451163/how-to-set-default-size-of-macos-app-in-flutter) to be similar. Edit and Add MacOS to your question it will help you get better answers. – dev-aentgs Jun 24 '20 at 10:56

2 Answers2

5

The window_size plugin will let you find the size of the screen and resize the window.

smorgan
  • 20,228
  • 3
  • 47
  • 55
  • Tried this and it still comes up same size. For example if the screen width originally starts as 800, and I set it to a minimum of 1000 with this plugin, it still starts at 800 then when I try and drag it then snaps to the specified 1000 and maintains it as the minimum from there on. – West Jun 30 '21 at 08:18
  • Setting the minimum size and setting the current size are not the same call. Also, the question here wasn't about minimum size. – smorgan Jun 30 '21 at 22:01
5

you can use window_manager

await windowManager.setSize(Size(800, 600));

or desktop_window

 Size size = await DesktopWindow.getWindowSize();
 DesktopWindow.setWindowSize(Size(800,600));
 DesktopWindow.setFullScreen(true);
Ali80
  • 6,333
  • 2
  • 43
  • 33