Connect independent resizable chat panes with routed focus and narrow layouts
This commit is contained in:
@@ -21,11 +21,15 @@ class ChatWorkspace extends StatefulWidget {
|
||||
required this.paneBuilder,
|
||||
this.onFocusPane,
|
||||
this.shortcutsEnabled = true,
|
||||
this.singlePane = false,
|
||||
});
|
||||
final ChatWorkspaceController controller;
|
||||
final ChatWorkspacePaneBuilder paneBuilder;
|
||||
final bool shortcutsEnabled;
|
||||
|
||||
/// Keeps the retained layout while presenting only the active chat.
|
||||
final bool singlePane;
|
||||
|
||||
/// Keyboard navigation only: the owner can focus the target composer.
|
||||
/// Pointer activation leaves text-selection and pointer focus alone.
|
||||
final ValueChanged<ChatWorkspacePane>? onFocusPane;
|
||||
@@ -109,6 +113,7 @@ class _ChatWorkspaceState extends State<ChatWorkspace> {
|
||||
if (root == null) return const SizedBox.shrink();
|
||||
final geometry = ChatWorkspaceGeometry(root, constraints.biggest);
|
||||
_geometry = geometry;
|
||||
final collapsed = widget.singlePane || geometry.collapsed;
|
||||
final panes = widget.controller.panes;
|
||||
final existing = panes.map((p) => p.id).toSet();
|
||||
for (final id
|
||||
@@ -123,16 +128,15 @@ class _ChatWorkspaceState extends State<ChatWorkspace> {
|
||||
for (final pane in panes)
|
||||
Positioned.fromRect(
|
||||
key: ValueKey('chat-workspace-${pane.id}'),
|
||||
rect: geometry.collapsed
|
||||
rect: collapsed
|
||||
? Offset.zero & constraints.biggest
|
||||
: geometry.panes[pane.id]!,
|
||||
child: Offstage(
|
||||
offstage:
|
||||
geometry.collapsed &&
|
||||
pane.id != widget.controller.activePaneId,
|
||||
collapsed && pane.id != widget.controller.activePaneId,
|
||||
child: ExcludeFocus(
|
||||
excluding:
|
||||
geometry.collapsed &&
|
||||
collapsed &&
|
||||
pane.id != widget.controller.activePaneId,
|
||||
child: FocusScope(
|
||||
node: _panes.putIfAbsent(
|
||||
@@ -160,7 +164,7 @@ class _ChatWorkspaceState extends State<ChatWorkspace> {
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!geometry.collapsed)
|
||||
if (!collapsed)
|
||||
for (final divider in geometry.dividers)
|
||||
Positioned.fromRect(
|
||||
key: ValueKey('chat-workspace-${divider.split.id}'),
|
||||
|
||||
Reference in New Issue
Block a user