fix: cm window block on setSize

This commit is contained in:
Kingtous 2022-10-17 11:53:15 +08:00 committed by kingtous
parent 268dddc303
commit 0522471b39

View File

@ -194,13 +194,10 @@ void runPortForwardScreen(Map<String, dynamic> argument) async {
} }
void runConnectionManagerScreen() async { void runConnectionManagerScreen() async {
await initEnv(kAppTypeMain);
// initialize window // initialize window
WindowOptions windowOptions = WindowOptions windowOptions =
getHiddenTitleBarWindowOptions(size: kConnectionManagerWindowSize); getHiddenTitleBarWindowOptions(size: kConnectionManagerWindowSize);
// ensure initial window size to be changed
await windowManager.setSize(kConnectionManagerWindowSize);
await Future.wait(
[windowManager.setAlignment(Alignment.topRight), initEnv(kAppTypeMain)]);
runApp(GetMaterialApp( runApp(GetMaterialApp(
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
theme: MyTheme.lightTheme, theme: MyTheme.lightTheme,
@ -215,10 +212,16 @@ void runConnectionManagerScreen() async {
home: const DesktopServerPage(), home: const DesktopServerPage(),
builder: _keepScaleBuilder())); builder: _keepScaleBuilder()));
windowManager.waitUntilReadyToShow(windowOptions, () async { windowManager.waitUntilReadyToShow(windowOptions, () async {
windowManager.show(); await windowManager.show();
windowManager.focus(); // ensure initial window size to be changed
windowManager.setOpacity(1); await windowManager.setSize(kConnectionManagerWindowSize);
windowManager.setAlignment(Alignment.topRight); // ensure await Future.wait([
windowManager.setAlignment(Alignment.topRight),
windowManager.focus(),
windowManager.setOpacity(1)
]);
// ensure
windowManager.setAlignment(Alignment.topRight);
}); });
} }