waitUntilReadyToShow method

Future<void> waitUntilReadyToShow([
  1. WindowOptions? options,
  2. VoidCallback? callback
])

Wait until ready to show.

Implementation

Future<void> waitUntilReadyToShow([
  WindowOptions? options,
  VoidCallback? callback,
]) 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();

  if (options?.size != null) await setSize(options!.size!);
  if (options?.center == true) await setAlignment(Alignment.center);
  if (options?.minimumSize != null) {
    await setMinimumSize(options!.minimumSize!);
  }
  if (options?.maximumSize != null) {
    await setMaximumSize(options!.maximumSize!);
  }
  if (options?.alwaysOnTop != null) {
    await setAlwaysOnTop(options!.alwaysOnTop!);
  }
  if (options?.fullScreen != null) await setFullScreen(options!.fullScreen!);
  if (options?.backgroundColor != null) {
    await setBackgroundColor(options!.backgroundColor!);
  }
  if (options?.skipTaskbar != null) {
    await setSkipTaskbar(options!.skipTaskbar!);
  }
  if (options?.title != null) await setTitle(options!.title!);

  if (callback != null) {
    callback();
  }
}