Keep one shared separator between chat panes

This commit is contained in:
2026-11-08 14:41:04 +00:00
parent 9acf37b61b
commit 4f51470202
4 changed files with 236 additions and 49 deletions
@@ -296,55 +296,68 @@ mixin _ChatScreenWorkspace on State<ChatScreen> {
paneTitle: (pane) =>
'${_rowFor(pane.sessionId)?['title'] ?? pane.sessionId}',
onFocusPane: (pane) => _composerFocus.request(pane.sessionId),
paneBuilder: (context, pane, active) => Semantics(
selected: active,
child: AnimatedContainer(
duration: showsListBesideDetail(context)
? Motion.of(context, Motion.standard)
: Duration.zero,
curve: Motion.curve,
foregroundDecoration: BoxDecoration(
border: !showsListBesideDetail(context)
? Border(
bottom: BorderSide(
color: _workspace.paneCount > 1 && active
? chatColorShade(
context,
chatSessionColor(_rowFor(pane.sessionId)),
) ??
(chatControlsStyleOf(context) ==
ChatControlsStyle.cupertino
? CupertinoTheme.of(context).primaryColor
: Theme.of(context).colorScheme.primary)
: Colors.transparent,
paneBuilder: (context, pane, active) {
final scope = ChatWorkspacePaneScope.maybeOf(context);
final topShared = scope?.topEdgeShared ?? false;
final bottomShared = scope?.bottomEdgeShared ?? false;
final leftShared = scope?.leftEdgeShared ?? false;
final rightShared = scope?.rightEdgeShared ?? false;
final activeColor = _workspace.paneCount > 1 && active
? chatColorShade(
context,
chatSessionColor(_rowFor(pane.sessionId)),
) ??
(chatControlsStyleOf(context) == ChatControlsStyle.cupertino
? CupertinoTheme.of(context).primaryColor
: Theme.of(context).colorScheme.primary)
: Colors.transparent;
return Semantics(
selected: active,
child: AnimatedContainer(
duration: showsListBesideDetail(context)
? Motion.of(context, Motion.standard)
: Duration.zero,
curve: Motion.curve,
foregroundDecoration: BoxDecoration(
border: showsListBesideDetail(context)
? Border(
top: bottomShared && !topShared
? BorderSide(color: activeColor)
: BorderSide.none,
bottom: BorderSide(
color: bottomShared ? Colors.transparent : activeColor,
),
left: bottomShared && topShared && !leftShared
? BorderSide(color: activeColor)
: BorderSide.none,
right:
bottomShared &&
topShared &&
leftShared &&
!rightShared
? BorderSide(color: activeColor)
: BorderSide.none,
)
: Border(
bottom: BorderSide(
color: bottomShared ? Colors.transparent : activeColor,
),
),
)
: Border.all(
color: _workspace.paneCount > 1 && active
? chatColorShade(
context,
chatSessionColor(_rowFor(pane.sessionId)),
) ??
(chatControlsStyleOf(context) ==
ChatControlsStyle.cupertino
? CupertinoTheme.of(context).primaryColor
: Theme.of(context).colorScheme.primary)
: Colors.transparent,
),
),
child: DetailPane(
key: ValueKey('chat-pane-detail-${pane.id}'),
destination: AppDestination.chat,
implyBack: false,
builder: (context) => _thread(
pane.sessionId,
_back,
pane: pane,
paneContext: context,
),
child: DetailPane(
key: ValueKey('chat-pane-detail-${pane.id}'),
destination: AppDestination.chat,
implyBack: false,
builder: (context) => _thread(
pane.sessionId,
_back,
pane: pane,
paneContext: context,
),
),
),
),
),
);
},
),
);
}
@@ -17,6 +17,33 @@ export 'chat_workspace_geometry.dart' show ChatPaneDirection;
typedef ChatWorkspacePaneBuilder =
Widget Function(BuildContext context, ChatWorkspacePane pane, bool active);
/// Describes the edge ownership of the pane currently being built.
class ChatWorkspacePaneScope extends InheritedWidget {
const ChatWorkspacePaneScope({
super.key,
required this.topEdgeShared,
required this.bottomEdgeShared,
required this.leftEdgeShared,
required this.rightEdgeShared,
required super.child,
});
final bool topEdgeShared;
final bool bottomEdgeShared;
final bool leftEdgeShared;
final bool rightEdgeShared;
static ChatWorkspacePaneScope? maybeOf(BuildContext context) =>
context.dependOnInheritedWidgetOfExactType<ChatWorkspacePaneScope>();
@override
bool updateShouldNotify(ChatWorkspacePaneScope oldWidget) =>
topEdgeShared != oldWidget.topEdgeShared ||
bottomEdgeShared != oldWidget.bottomEdgeShared ||
leftEdgeShared != oldWidget.leftEdgeShared ||
rightEdgeShared != oldWidget.rightEdgeShared;
}
/// All chat views are stable siblings, independent of the split tree. Moving a
/// divider or adding/removing a neighbouring split never reparents a chat view.
class ChatWorkspace extends StatefulWidget {
@@ -223,6 +250,39 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
final node = _panes.remove(id)!;
WidgetsBinding.instance.addPostFrameCallback((_) => node.dispose());
}
bool sharesEdge(Rect pane, String edge) => geometry.dividers.any((
divider,
) {
final horizontalOverlap =
pane.left < divider.rect.right &&
pane.right > divider.rect.left;
final verticalOverlap =
pane.top < divider.rect.bottom &&
pane.bottom > divider.rect.top;
return switch (edge) {
'top' =>
(pane.top - divider.rect.bottom).abs() < .5 &&
horizontalOverlap,
'bottom' =>
(pane.bottom - divider.rect.top).abs() < .5 &&
horizontalOverlap,
'left' =>
(pane.left - divider.rect.right).abs() < .5 && verticalOverlap,
'right' =>
(pane.right - divider.rect.left).abs() < .5 && verticalOverlap,
_ => false,
};
});
final sharedEdges = <String, Set<String>>{
for (final entry in geometry.panes.entries)
entry.key: {
for (final edge in const ['top', 'bottom', 'left', 'right'])
if (!collapsed &&
mobile == null &&
sharesEdge(entry.value, edge))
edge,
},
};
return chatWorkspaceSurface(
context: context,
backdrop: _backdrop,
@@ -233,7 +293,8 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
collapsed: collapsed,
size: constraints.biggest,
panes: panes,
paneView: (pane) => _paneView(pane, mobile, collapsed, activeId),
paneView: (pane) =>
_paneView(pane, mobile, collapsed, activeId, sharedEdges),
);
},
),
@@ -245,6 +306,7 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
ChatMobilePanes? mobile,
bool collapsed,
String? activeId,
Map<String, Set<String>> sharedEdges,
) {
final outgoing = _motion.isRetainedOutgoing(pane.id);
final peek = mobile?.peekId == pane.id || outgoing;
@@ -286,7 +348,19 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
identifier: 'chat-pane-${pane.id}',
container: true,
sortKey: mobile == null ? null : const OrdinalSortKey(0),
child: widget.paneBuilder(context, pane, active),
child: ChatWorkspacePaneScope(
topEdgeShared: sharedEdges[pane.id]?.contains('top') ?? false,
bottomEdgeShared:
sharedEdges[pane.id]?.contains('bottom') ?? false,
leftEdgeShared:
sharedEdges[pane.id]?.contains('left') ?? false,
rightEdgeShared:
sharedEdges[pane.id]?.contains('right') ?? false,
child: Builder(
builder: (paneContext) =>
widget.paneBuilder(paneContext, pane, active),
),
),
),
),
),
+32
View File
@@ -0,0 +1,32 @@
# Single shared chat-pane separator
Wide panes no longer paint full outlines beside the shared resize separator.
The active chat paints one available outer edge (bottom, top, left or right),
with the existing animated session color. Shared internal edges remain silent.
The existing divider line and resize grip are the only separator between panes.
Mobile keeps its bottom-only indicator, peek sizing and animation behavior.
Pane edge ownership is derived from existing split geometry through an inherited
scope; pane identities, layout bounds, controllers and persistence are unchanged.
Verification:
- Manager focused watchdog: 58 passed (`/tmp/memwatch/out.uA3xjj`).
- Analyzer clean (`flutter-analyze.CTkzGf`); fixture build passed.
- Inspected full-app Material/Cupertino side-by-side and nested stacked panes,
upper/middle active selection and both divider drags. Evidence under
`/tmp/review/single-separator-material` and `single-separator-cupertino`;
key inspected PNGs are `03-upper-active.png`, `04-middle-active.png` and
`05-resized.png`. No native device verification.
Workflow record: run288 implemented the patch. Code review first caught a missing
upper-pane active indicator; the correction passed. The next code review wrongly
required captures before its downstream UI-review stage. The manager canceled
that duplicate loop, preserved its changes/captures, and completed browser checks
directly. Existing pipeline32 versions2/3 remove duplicate implementation capture
work, make the review boundary explicit, and leave checked landing to the manager
so unrelated untracked user files are preserved. No new recovery workflow was made.
A manager parallel bootstrap attempt collided in Flutter's generated iOS package
folder and ran no tests; sequential checks/build above passed afterward.
No server restart, real operator-data mutation, deployment or device installation
was performed for this individual task; combined release follows the sidebar run.
@@ -7,6 +7,7 @@ import 'package:pipelines_app/features/chat/conversation/chat_composer_bar.dart'
import 'package:pipelines_app/features/chat/conversation/chat_thread_view.dart';
import 'package:pipelines_app/features/chat/ui/sessions/chat_color_palette.dart';
import 'package:pipelines_app/features/chat/workspace/chat_workspace.dart';
import 'package:pipelines_app/features/chat/workspace/chat_workspace_divider.dart';
import 'package:pipelines_app/shell/adaptive_shell.dart';
import 'package:pipelines_app/shell/destination.dart';
@@ -97,7 +98,7 @@ Border _paneBorder(WidgetTester tester, String id) {
}
Color _border(WidgetTester tester, String id) =>
_paneBorder(tester, id).top.color;
_paneBorder(tester, id).bottom.color;
void main() {
testWidgets(
@@ -153,6 +154,43 @@ void main() {
_border(tester, 'c'),
Theme.of(tester.element(_thread('c'))).colorScheme.primary,
);
controller.activate(
controller.panes.firstWhere((p) => p.sessionId == 'a').id,
);
await tester.pumpAndSettle();
final scope = tester.widget<ChatWorkspacePaneScope>(
find
.ancestor(
of: _thread('a'),
matching: find.byType(ChatWorkspacePaneScope),
)
.first,
);
expect(scope.bottomEdgeShared, isTrue);
expect(_border(tester, 'a'), Colors.transparent);
expect(
_paneBorder(tester, 'a').top.color,
chatColorShade(tester.element(_thread('a')), 'orange'),
);
expect(tester.takeException(), isNull);
});
testWidgets('wide panes leave the shared divider to the workspace', (
tester,
) async {
await _mount(tester, const Size(1800, 1000));
final controller = tester
.widget<ChatWorkspace>(find.byType(ChatWorkspace))
.controller;
controller.splitActive('b', ChatSplitAxis.horizontal);
await tester.pumpAndSettle();
for (final pane in controller.panes) {
final border = _paneBorder(tester, pane.sessionId);
expect(border.left.style, BorderStyle.none);
expect(border.right.style, BorderStyle.none);
expect(border.top.style, BorderStyle.none);
}
expect(find.byType(ChatWorkspaceDivider), findsOneWidget);
expect(tester.takeException(), isNull);
});
testWidgets('desktop focus border fades between retained panes', (
@@ -225,4 +263,34 @@ void main() {
);
expect(tester.takeException(), isNull);
});
testWidgets(
'middle stacked pane never adds a stroke beside either shared divider',
(tester) async {
await _mount(tester, const Size(1800, 1200));
final controller = tester
.widget<ChatWorkspace>(find.byType(ChatWorkspace))
.controller;
controller.splitActive('b', ChatSplitAxis.vertical);
controller.splitActive('c', ChatSplitAxis.vertical);
controller.activate(
controller.panes.firstWhere((pane) => pane.sessionId == 'b').id,
);
await tester.pumpAndSettle();
final border = _paneBorder(tester, 'b');
bool painted(BorderSide side) =>
side.style != BorderStyle.none && side.color.a > 0;
expect(
painted(border.top),
isFalse,
reason: 'middle pane top meets a shared separator',
);
expect(
painted(border.bottom),
isFalse,
reason: 'middle pane bottom meets a shared separator',
);
expect(find.byType(ChatWorkspaceDivider), findsNWidgets(2));
expect(tester.takeException(), isNull);
},
);
}