fdc730422d
Phase 2.3 and 2.4 of docs/plans/floating-windows.md. A floating chat is a window of the chat kind over the app's WindowManager, built from the app-lifetime ChatRuntime, so it shows over every destination and at start without the Chat destination being built. Float and Dock move the same keyed view between the tiling and the window host. The pipelines app keeps one runtime and one ChatWindows; saved chatFloat records (v1 and v2) are brought over once. ChatFloatHost, ChatFloatWindow, the float frames and binding, the controller's float list and FloatingFocusRoot are gone; the workspace only asks whether a chat is out in a window. Every MenuAnchor targets the root overlay (guarded by a test), and menus and tooltips name the Alt chords.
69 lines
2.2 KiB
Dart
69 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../shell/windows/window_entry.dart';
|
|
import '../../../ui/adaptive/window_margins.dart';
|
|
import '../chat_pane_content.dart';
|
|
import 'chat_windows.dart';
|
|
|
|
/// A floating window's chat: the same live view as a tiled pane (see
|
|
/// [buildChatPaneContent]), with what a window decides. Before the server
|
|
/// has been reached it says so instead of reading a chat.
|
|
class ChatWindowContent extends StatelessWidget {
|
|
const ChatWindowContent({
|
|
super.key,
|
|
required this.windows,
|
|
required this.entry,
|
|
});
|
|
|
|
final ChatWindows windows;
|
|
final WindowEntry entry;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final runtime = windows.runtime;
|
|
final sessionId = entry.contentId;
|
|
return ListenableBuilder(
|
|
listenable: Listenable.merge([
|
|
runtime,
|
|
runtime.syncToken,
|
|
windows.readiness,
|
|
]),
|
|
builder: (context, _) {
|
|
// A chat is drawn once: the tiling wins, and this window closes.
|
|
if (windows.tiling?.holds(sessionId) ?? false) {
|
|
WidgetsBinding.instance.addPostFrameCallback(
|
|
(_) => windows.manager.close(entry.id),
|
|
);
|
|
return const SizedBox.shrink();
|
|
}
|
|
if (!windows.ready) {
|
|
return Center(
|
|
child: Text(
|
|
'Connecting…',
|
|
style: Theme.of(context).textTheme.bodyMedium,
|
|
),
|
|
);
|
|
}
|
|
// A small window keeps the compact bar insets.
|
|
return WindowMargins.compact(
|
|
child: buildChatPaneContent(
|
|
runtime: runtime,
|
|
sessionId: sessionId,
|
|
placement: ChatPanePlacement(
|
|
syncToken: runtime.syncToken.value,
|
|
onBack: () {},
|
|
showBackButton: false,
|
|
// Never the active pane: its composer takes a paste while it
|
|
// has the keyboard.
|
|
ownsPasteWhenFocused: true,
|
|
onNewSession: (previousId, session, notice) => windows
|
|
.startedNewSession(entry.id, previousId, session, notice),
|
|
onSessionClosed: () => windows.sessionClosed(entry.id),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|