use*_*216 14 desktop-application dart flutter
在搜索官方文档时我无法找到任何方法来做到这一点。有人知道有什么方法可以做到这一点吗?
tom*_*ozb 20
这是可能的,正如https://github.com/flutter/flutter/issues/30712中提到的
在pubspec.yaml添加
dependencies:
window_size:
git:
url: https://github.com/google/flutter-desktop-embedding.git
path: plugins/window_size
ref: fd519be1e8398c6b6c2062c2447bac960a71bc02
Run Code Online (Sandbox Code Playgroud)
现在在你的代码中只需调用
import 'package:window_size/window_size.dart';
WidgetsFlutterBinding.ensureInitialized();
setWindowTitle("Custom window title");
Run Code Online (Sandbox Code Playgroud)
在 Linux 上运行良好。尚未在 Windows/Mac 上测试
PS 感谢@Johan Ordenes Galleguillos 为失踪者提供帮助WidgetsFlutterBinding.ensureInitialized();
| 归档时间: |
|
| 查看次数: |
10457 次 |
| 最近记录: |