如何在Flutter桌面应用中禁用窗口调整大小

huangapple go评论128阅读模式
英文:

How to disable window resizing in a flutter desktop app

问题

我想在Flutter桌面应用程序上禁用屏幕调整大小,但似乎不起作用。我还想更改窗口标题。

import 'package:desktop_window/desktop_window.dart';
void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await DesktopWindow.setMinWindowSize(const Size(1280, 720));
  await DesktopWindow.setMaxWindowSize(const Size(1280, 720));
  runApp(MyApp());
}
英文:

I want to disable screen resizing on a flutter desktop application but it doesn't seem to work. I also want to change the window title.

import 'package:desktop_window/desktop_window.dart';
    void main() async {
      WidgetsFlutterBinding.ensureInitialized();
      await DesktopWindow.setMinWindowSize(const Size(1280, 720));
      await DesktopWindow.setMaxWindowSize(const Size(1280, 720));
      runApp(MyApp());
    }

答案1

得分: 1

我建议您使用window_manager包,使用该包,您可以配置用户是否能够调整窗口大小。更多信息请参阅:https://pub.dev/packages/window_manager#setresizable

英文:

I would recommend you to use the window_manager package, with this package you can configure if the user should be able to resize the window or not. More info here:
https://pub.dev/packages/window_manager#setresizable

huangapple
  • 本文由 发表于 2023年4月7日 01:15:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/75952129.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定