openNetworkBodyInNewWindow method
Future<void>
openNetworkBodyInNewWindow({
- required InfospectNetworkCall call,
- required NetworkBodyKind kind,
- bool detailsInitiallyExpanded = false,
Opens a network call body (with request metadata) in a new desktop window.
If the same call + body kind is already open, focuses that window instead.
Implementation
Future<void> openNetworkBodyInNewWindow({
required InfospectNetworkCall call,
required NetworkBodyKind kind,
bool detailsInitiallyExpanded = false,
}) async {
if (kIsWeb || !InfospectUtil.isDesktop) return;
_ensureWindowCloseListener();
final bodyKey = _networkBodyWindowKey(call.id, kind);
final existingId = _networkBodyWindowIds[bodyKey];
if (existingId != null &&
MultiViewDesktop.allWindowViewIds.contains(existingId)) {
await _focusWindow(existingId);
return;
}
final bool darkTheme = _infospect.context != null ? isDarkTheme : true;
final title =
kind == NetworkBodyKind.request ? 'Request Body' : 'Response Body';
final windowId = await openWindow(
(context, id) => NetworkBodyWindowScreen(
call: call,
kind: kind,
detailsInitiallyExpanded: detailsInitiallyExpanded,
),
options: WindowOptions(
title: '$title ยท ${call.method} ${call.endpoint}',
size: const Size(980, 760),
minimumSize: const Size(560, 420),
alignment: Alignment.center,
shellOverrides: ViewShellOverrides(
appearance: AppShellPatch(
theme: InfospectTheme.lightTheme,
darkTheme: InfospectTheme.darkTheme,
themeMode: darkTheme ? ThemeMode.dark : ThemeMode.light,
),
),
),
);
_networkBodyWindowIds[bodyKey] = windowId;
}