How to set size for a window in a Flutter application?

75 Views Asked by At

I'm building a calculator and I want the window of the app to open tallest than largest, I've tried window_manager (following the installation process by the guide (https://pub.dev/packages/window_manager#windowmanager) ) and the code give 0 problems but nothing changed (I've also copied the usage example to see any changes, trying to change it by myself but didn't work).

// ignore_for_file: non_constant_identifier_names

import 'package:window_manager/window_manager.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  // Must add this line.
  await windowManager.ensureInitialized();
  WindowOptions windowOptions = const WindowOptions(
    size: Size(410, 600),
    center: true,
    backgroundColor: Colors.transparent,
    skipTaskbar: false,
    titleBarStyle: TitleBarStyle.hidden,
  );
  windowManager.waitUntilReadyToShow(windowOptions, () async {
    await windowManager.show();
    await windowManager.focus();
  });
  runApp(const MyApp());
}

This is the only part I changed from my main.dart

dependencies:
  window_manager:
    git:
      url: https://github.com/leanflutter/window_manager.git
      ref: main

and this is the part I changed from pubspec.yaml

I've already tried to close and reopen VS code, but nothing to do. The only change I see is that the bar on the top (not appBar, the one with the project name and the x to close) disappear if I comment titleBarStyle: TitleBarStyle.hidden,.

For context, I'm using arch linux with gnome.

0

There are 0 best solutions below