infospectDesktopWindowOptions function

WindowOptions infospectDesktopWindowOptions({
  1. String? title,
  2. Size? size,
  3. Size? minimumSize,
  4. Size? maximumSize,
  5. Alignment? alignment = Alignment.center,
  6. Color? backgroundColor,
  7. bool? fullScreen,
  8. bool? alwaysOnTop,
  9. ViewShellOverrides? shellOverrides,
  10. bool enableCloseShortcut = true,
})

Shared desktop window chrome for Infospect.

multiview_desktop's resetWindowToDefaults hides native min / max / close buttons when WindowOptions.windowButtonVisibility is null. Always pass these defaults for the host app and every Infospect secondary window.

When enableCloseShortcut is true (default), wraps the window shell so ⌘W / Ctrl+W closes this focused Infospect window.

Implementation

WindowOptions infospectDesktopWindowOptions({
  String? title,
  Size? size,
  Size? minimumSize,
  Size? maximumSize,
  Alignment? alignment = Alignment.center,
  Color? backgroundColor,
  bool? fullScreen,
  bool? alwaysOnTop,
  ViewShellOverrides? shellOverrides,
  bool enableCloseShortcut = true,
}) {
  final ViewShellOverrides? merged;
  if (!enableCloseShortcut) {
    merged = shellOverrides;
  } else {
    merged = ViewShellOverrides.merge(
      shellOverrides,
      ViewShellOverrides(
        builder: (context, child) {
          final built =
              shellOverrides?.builder?.call(context, child) ?? child;
          return InfospectDesktopWindowShortcuts(
            child: built ?? const SizedBox.shrink(),
          );
        },
      ),
    );
  }

  return WindowOptions(
    title: title,
    size: size,
    minimumSize: minimumSize,
    maximumSize: maximumSize,
    alignment: alignment,
    backgroundColor: backgroundColor,
    fullScreen: fullScreen,
    alwaysOnTop: alwaysOnTop,
    titleBarStyle: TitleBarStyle.normal,
    windowButtonVisibility: true,
    shellOverrides: merged,
  );
}