popOutDesktopTab method

Future<void> popOutDesktopTab(
  1. InfospectDesktopTab tab
)

Opens tab in a separate window and removes it from the main Infospect UI.

Implementation

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

  _ensureNotifiers();
  _ensureWindowCloseListener();

  final existingId = _windowIdFor(tab);
  if (existingId != null &&
      MultiViewDesktop.allWindowViewIds.contains(existingId)) {
    await _focusWindow(existingId);
    _markTabPoppedOut(tab);
    return;
  }

  final bool darkTheme = _infospect.context != null ? isDarkTheme : true;
  final windowId = await openWindow(
    (context, id) => _tabWindowScreen(tab),
    options: WindowOptions(
      title: '${tab.windowTitle} ยท Infospect',
      size: const Size(1100, 720),
      minimumSize: const Size(720, 480),
      alignment: Alignment.center,
      shellOverrides: ViewShellOverrides(
        appearance: AppShellPatch(
          theme: InfospectTheme.lightTheme,
          darkTheme: InfospectTheme.darkTheme,
          themeMode: darkTheme ? ThemeMode.dark : ThemeMode.light,
        ),
      ),
    ),
  );

  _setWindowIdFor(tab, windowId);
  _markTabPoppedOut(tab);
}