Flutter Desktop Apps: Getting Started

Mar 28 2023 · Dart 2.19, Flutter 3.7, Android Studio 2021.3.1 or higher, Visual Studo Code 1.7.4 or higher

Part 1: Flutter Desktop Apps

04. Setting & Limiting the Window Size

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 03. Create a Flutter Desktop App Next episode: 05. Create System Menus

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Todo App

If you’ve used Flutter before, you’ve seen the errors that happen when a widget overflows. This displays errors on the screen that will confuse the user. Since the user can change the size of the window that desktop apps are run on, this can cause display errors. You can prevent some of these errors by preventing the user from making the window too small.

Android Studio

Open up the starter project. In the project window, open up pubspec.yaml. After the path_provider package, add desktop_window: ^0.4.0. This will add the desktop_window plugin. Hit Pub get to download the plugin.

if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {
  await DesktopWindow.setWindowSize(const Size(700,500));

  await DesktopWindow.setMinWindowSize(const Size(700,500));
  await DesktopWindow.setMaxWindowSize(Size.infinite);
}