openInspectorInNewWindow method

Future<void> openInspectorInNewWindow()

Opens the inspector in a new window (applicable only on desktop platforms).

Implementation

Future<void> openInspectorInNewWindow() async {
  if (kIsWeb || !InfospectUtil.isDesktop) return;

  if (_infospectWindowId != null &&
      MultiViewDesktop.allWindowViewIds.contains(_infospectWindowId)) {
    final window = MultiViewDesktop.fromId(_infospectWindowId!);
    await window.show();
    await window.focus();
    return;
  }

  _syncPoppedOutFromOpenWindows();

  final bool darkTheme = _infospect.context != null ? isDarkTheme : true;

  _infospectWindowId = await openWindow(
    (context, id) => interceptorScreen(isDarkTheme: darkTheme),
    options: WindowOptions(
      title: InfospectDataTransfer.windowName,
      size: const Size(1280, 720),
      minimumSize: const Size(800, 600),
      alignment: Alignment.center,
      shellOverrides: ViewShellOverrides(
        appearance: AppShellPatch(
          theme: InfospectTheme.lightTheme,
          darkTheme: InfospectTheme.darkTheme,
          themeMode: darkTheme ? ThemeMode.dark : ThemeMode.light,
        ),
      ),
    ),
  );
  _ensureWindowCloseListener();
}