feat: record window position (#692)

This commit is contained in:
Noo6
2025-02-05 20:59:04 +08:00
committed by GitHub
parent 900686f955
commit 20a39f0292
3 changed files with 25 additions and 13 deletions

View File

@@ -53,15 +53,7 @@ Future<void> _initApp() async {
await Paths.init(BuildData.name, bakName: 'srvbox_bak.json');
await _initData();
_setupDebug();
final windowSize = Stores.setting.windowSize;
final hideTitleBar = Stores.setting.hideTitleBar.fetch();
await SystemUIs.initDesktopWindow(
hideTitleBar: hideTitleBar,
size: windowSize.fetch().toSize(),
listener: WindowSizeListener(windowSize),
);
_initWindow();
FontUtils.loadFrom(Stores.setting.fontPath.fetch());
_doPlatformRelated();
@@ -130,3 +122,16 @@ Future<void> _doVersionRelated() async {
Stores.setting.lastVer.put(newVer);
}
}
Future<void> _initWindow() async {
if (!isDesktop) return;
final windowStateProp = Stores.setting.windowState;
final windowState = windowStateProp.fetch();
final hideTitleBar = Stores.setting.hideTitleBar.fetch();
await SystemUIs.initDesktopWindow(
hideTitleBar: hideTitleBar,
size: windowState?.size,
position: windowState?.position,
listener: WindowStateListener(windowStateProp),
);
}