Mark the chat center-stage edges

Add subtle outlineVariant hairlines around the centered chat column so its boundary remains clear without changing the reading width or split layout. Cover light and dark center-stage visibility with focused widget and geometry tests.
This commit is contained in:
2026-11-12 01:01:25 +00:00
parent 4f1b45571f
commit 5834b9c504
4 changed files with 164 additions and 0 deletions
@@ -0,0 +1,48 @@
import 'package:flutter/material.dart';
import 'chat_center_stage_layout.dart';
/// Hairline thickness of a center-stage edge.
const double chatCenterStageEdgeThickness = 1;
/// Where the stage's two hairlines sit: each in the gap beside the stage, or on
/// the workspace edge when the stage reaches it. Returns (left, right).
(Rect, Rect) chatCenterStageEdgeRects(Rect stage, Size size) {
final half = chatCenterStageGap / 2;
const t = chatCenterStageEdgeThickness;
final maxX = size.width - t;
final leftX = stage.left <= 0
? 0.0
: (stage.left - half - t / 2).clamp(0.0, maxX).toDouble();
final rightX = stage.right >= size.width
? maxX
: (stage.right + half - t / 2).clamp(0.0, maxX).toDouble();
return (
Rect.fromLTWH(leftX, 0, t, size.height),
Rect.fromLTWH(rightX, 0, t, size.height),
);
}
/// The stage's left and right hairlines in the workspace's stack, drawn in the
/// theme's outlineVariant so the centred chat column has a visible boundary.
/// Only center stage calls this; the split layout keeps its own dividers.
List<Widget> chatCenterStageEdges({
required BuildContext context,
required Rect rect,
required Size size,
}) {
final color = Theme.of(context).colorScheme.outlineVariant;
final (left, right) = chatCenterStageEdgeRects(rect, size);
return [
Positioned.fromRect(
key: const ValueKey('chat-center-stage-edge-left'),
rect: left,
child: ColoredBox(color: color),
),
Positioned.fromRect(
key: const ValueKey('chat-center-stage-edge-right'),
rect: right,
child: ColoredBox(color: color),
),
];
}
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'chat_center_stage_edges.dart';
import 'chat_center_stage_motion.dart';
import 'chat_center_stage_strip.dart';
import 'chat_mobile_panes.dart';
@@ -138,6 +139,12 @@ Widget chatWorkspaceSurface({
for (final pane in livePanes)
if (pane.key == ValueKey('chat-workspace-${motion.topPaneId}'))
pane,
if (stage.stage case final layout?)
...chatCenterStageEdges(
context: context,
rect: stage.rectFor(layout.stageId)!,
size: size,
),
if (mobile?.peekId != null && !motion.isAnimating)
Positioned(
top: mobile!.contentHeight - 12,
+40
View File
@@ -0,0 +1,40 @@
# Center stage column edges
## Change
- In center stage (Alt+E / Option+E), the centred chat column had no visible
boundary: its neighbours are strips or the workspace background, so the
column's end read as unfinished.
- Added two 1px `outlineVariant` hairlines (`ChatCenterStageEdges` in
`app/lib/features/chat/workspace/chat_center_stage_edges.dart`). Each sits
centred in the 12px gap beside the stage, or on the workspace edge when the
stage reaches it.
- Painted from `chat_workspace_surface.dart`, only while a stage layout exists.
The split layout, phone/collapsed layouts and single-chat workspaces draw
nothing new.
- Reading width is unchanged (stage stays `chatCenterStageWidth`, 950 at the
test size). The lines travel with the stage's animated rectangle.
## Focused results
- `tool/memwatch/full.sh 'test/features/chat/workspace/chat_center_stage_test.dart'`
→ PASS: 21 passed, 0 failed, 0 skipped; peak 893 MB; 8s; exit 0.
New tests among them:
- `the stage edges sit in the gaps beside the stage, or on the workspace edge`
- `center stage draws the column edges in the light theme, only on stage`
- `center stage draws the column edges in the dark theme, only on stage`
- `tool/analyze.sh` → clean, exit 0.
- Not run: other `test/features/chat/workspace/*` files use `ChatWorkspace`
without `centerStage` on stage, so the new branch is not reached there. The
land gate runs the suites.
## Affected states (code-level only)
- Center stage on, 3 panes, light and dark: both hairlines present, colour is
the theme's `outlineVariant`.
- Center stage off: no hairlines (asserted in both themes).
- Stage with a neighbour on each side (gaps) and stage at a workspace edge
(line on the edge) are both covered by the geometry test.
## Limitations
- No browser or device capture was made; `ui-review` owns visual evidence.
Visual weight of a 1px `outlineVariant` line in light and dark is unverified.
- Hairlines hide at once when leaving center stage (same as the split
dividers); they do not fade.
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/chat/workspace/chat_center_stage_controller.dart';
import 'package:pipelines_app/features/chat/workspace/chat_center_stage_edges.dart';
import 'package:pipelines_app/features/chat/workspace/chat_center_stage_keys.dart';
import 'package:pipelines_app/features/chat/workspace/chat_center_stage_layout.dart';
import 'package:pipelines_app/features/chat/workspace/chat_center_stage_strip.dart';
@@ -82,7 +83,10 @@ Widget host(
List<KeyEvent>? fieldKeys,
bool actionBars = false,
bool filesProbe = false,
ThemeMode themeMode = ThemeMode.light,
}) => MaterialApp(
themeMode: themeMode,
darkTheme: ThemeData.dark(),
home: MediaQuery(
data: MediaQueryData(disableAnimations: reduceMotion),
child: Scaffold(
@@ -410,6 +414,71 @@ void main() {
},
);
test(
'the stage edges sit in the gaps beside the stage, or on the workspace edge',
() {
final (left, right) = chatCenterStageEdgeRects(
const Rect.fromLTWH(418, 0, 950, 800),
const Size(1368, 800),
);
expect(left, const Rect.fromLTWH(411.5, 0, 1, 800));
expect(right, const Rect.fromLTWH(1367, 0, 1, 800));
// A stage that reaches the workspace's right edge keeps its hairline inside.
final (edgeLeft, edgeRight) = chatCenterStageEdgeRects(
const Rect.fromLTWH(650, 0, 950, 800),
const Size(1600, 800),
);
expect(edgeLeft, const Rect.fromLTWH(643.5, 0, 1, 800));
expect(edgeRight, const Rect.fromLTWH(1599, 0, 1, 800));
},
);
for (final mode in [ThemeMode.light, ThemeMode.dark]) {
testWidgets(
'center stage draws the column edges in the ${mode.name} theme, only on stage',
(tester) async {
wide(tester);
final workspace = threePanes();
final stage = ChatCenterStageController(store: _MemoryStore());
addTearDown(workspace.dispose);
addTearDown(stage.dispose);
await tester.pumpWidget(host(workspace, stage, themeMode: mode));
await tester.pumpAndSettle();
const leftKey = ValueKey('chat-center-stage-edge-left');
const rightKey = ValueKey('chat-center-stage-edge-right');
expect(find.byKey(leftKey), findsNothing);
expect(find.byKey(rightKey), findsNothing);
stage.value = true;
await tester.pumpAndSettle();
final outline = Theme.of(
tester.element(find.byType(ChatWorkspace)),
).colorScheme.outlineVariant;
for (final key in [leftKey, rightKey]) {
expect(
tester
.widget<ColoredBox>(
find.descendant(
of: find.byKey(key),
matching: find.byType(ColoredBox),
),
)
.color,
outline,
);
}
// The hairlines frame the stage; the reading width is unchanged.
expect(widthOf(tester, 'three'), 950);
stage.value = false;
await tester.pumpAndSettle();
expect(find.byKey(leftKey), findsNothing);
expect(find.byKey(rightKey), findsNothing);
},
);
}
testWidgets('reduced motion stages at once', (tester) async {
wide(tester);
final workspace = threePanes();