Open a diff as a floating window

Diffs join the app's window system: Open in a window on a diff page or a
chat diff card shows the same files, on the same file, in a draggable,
resizable window with the full diff viewer (keys, search, all-files
view). Offered only where floating windows show; a diff window's files
live in memory, so it is not restored after a reload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 20:06:45 +00:00
parent 71719b5707
commit dd742ec8e4
5 changed files with 271 additions and 5 deletions
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import '../../../../../core/api_gateway.dart';
import '../../../../changes/changes.dart';
import '../../../../changes/windows/diff_windows.dart';
import '../../../domain/chat_shown_diff.dart';
import 'chat_shown_surface.dart';
@@ -51,6 +52,15 @@ class _ChatShownDiffCardState extends State<ChatShownDiffCard> {
title: title,
subtitle: diff.comparison,
leading: Icon(Icons.difference_outlined, color: secondary),
trailing: switch (DiffWindowsScope.maybeOf(context)) {
final windows? when files.isNotEmpty => IconButton(
key: const Key('chat-shown-diff-window'),
tooltip: 'Open in a window',
onPressed: () => windows.open(files),
icon: const Icon(Icons.open_in_new),
),
_ => null,
},
),
),
Padding(