在搜索官方文档时,我无法找到任何方法来做到这一点。有谁知道有什么办法吗?
是可以的,在https://github.com/flutter/flutter/issues/30712中提到
在
pubspec.yaml
添加
dependencies:
window_size:
git:
url: git://github.com/google/flutter-desktop-embedding.git
path: plugins/window_size
ref: fd519be1e8398c6b6c2062c2447bac960a71bc02
现在在你的代码中调用
import 'package:window_size/window_size.dart';
setWindowTitle("Custom window title");
在 Linux 上运行良好。还没有在 Windows/Mac 上测试
转到 windows > runner > main.cpp 文件夹,找到一个 " !window.CreateAndShow(L"schedule_task", origin, size) " 并更改“schedule_task”文本
好吧,这似乎是不可能的(还),但正在进行中:https://github.com/flutter/flutter/issues/30712
通过使用 windowmanager 包实现了这一点。它有很多用于 flutter 桌面开发的特性。
安装包后只需将其添加到 main():
void main() async {
//needed to ensure binding was initialized
WidgetsFlutterBinding.ensureInitialized();
await WindowManager.instance.ensureInitialized();
windowManager.waitUntilReadyToShow().then((_) async {
await windowManager.setTitle('Yor title goes here');
});
runApp(const MyApp());
}
我在 Windows 和 Linux 上工作过。
参考资料: