google / flutter-desktop-embedding

Experimental plugins for Flutter for Desktop
Apache License 2.0
7.1k stars 604 forks source link

[window_size] setWindowMinSize calculates window size without using DPI on some Windows version #917

Closed me1ting closed 1 year ago

me1ting commented 1 year ago

Is this a bug in one of the plugins in this project?

Which plugin is this bug report about?

window_size

Describe the bug

The sample code:

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {
    setWindowMinSize(const Size(500, 500));
  }
  runApp(const MyApp());
}

On old Windows version(ltsb2016) with MSV Community 2019, the MinSize works right when using 125% DPI(but i didn't test what happen when using 100% DPI).

On new Windows version(ltsc2019) with MSV BuildTools 2019, the MinSise works right when using 100% DPI, but keeps 500*500 size(should be 625*625) when updating to 125% DPI.

Flutter doctor

[√] Flutter (Channel stable, 3.7.1, on Microsoft Windows [版本 10.0.17763.3887], locale zh-CN)
    • Flutter version 3.7.1 on channel stable at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7048ed95a5 (6 days ago), 2023-02-01 09:07:31 -0800
    • Engine revision 800594f1f4
    • Dart version 2.19.1
    • DevTools version 2.20.1

[X] Windows Version (Unable to confirm if installed Windows version is 10 or greater)

[√] Visual Studio - develop for Windows (Visual Studio 生成工具 2019 16.11.23)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
    • Visual Studio 生成工具 2019 version 16.11.33214.272
    • Windows 10 SDK version 10.0.19041.0

[√] VS Code (version 1.75.0)
    • VS Code at C:\Users\me\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.58.0

[√] Connected device (2 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [版本 10.0.17763.3887]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 109.0.5414.120
stuartmorgan commented 1 year ago

Closing as a duplicate of https://github.com/google/flutter-desktop-embedding/issues/911; the API currently requires you to scale yourself (using the Screen information you can query via the plugin) if you want to set a logical size.