From 597022bb0b4c4665327ede2b4895a284347e95c9 Mon Sep 17 00:00:00 2001 From: A Arif A S Date: Mon, 25 Sep 2023 06:05:29 +0700 Subject: [PATCH] fix: incorrect window size before/after `setTitleBarStyle` - Fixes issue where setting both `size` and `setTitleBarStyle` using `WindowOptions` in `waitUntilReadyToShow` causes incorrect window size. --- lib/src/window_manager.dart | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/src/window_manager.dart b/lib/src/window_manager.dart index c396b333..9b908725 100644 --- a/lib/src/window_manager.dart +++ b/lib/src/window_manager.dart @@ -115,6 +115,13 @@ class WindowManager { ]) async { await _channel.invokeMethod('waitUntilReadyToShow'); + if (options?.titleBarStyle != null) { + await setTitleBarStyle( + options!.titleBarStyle!, + windowButtonVisibility: options.windowButtonVisibility ?? true, + ); + } + if (await isFullScreen()) await setFullScreen(false); if (await isMaximized()) await unmaximize(); if (await isMinimized()) await restore(); @@ -138,12 +145,6 @@ class WindowManager { await setSkipTaskbar(options!.skipTaskbar!); } if (options?.title != null) await setTitle(options!.title!); - if (options?.titleBarStyle != null) { - await setTitleBarStyle( - options!.titleBarStyle!, - windowButtonVisibility: options.windowButtonVisibility ?? true, - ); - } if (callback != null) { callback();