Terminal round 3: readable palettes, panel and card sizing, rail, tabs

- Colours: terminal background is the theme's lowest surface; the 16 ANSI
  colours come from a chosen palette (Theme colours, Classic, Calm, Vivid;
  Settings > Terminal > Colours, saved as `palette`) adjusted in lightness
  to the background: colours 4.5:1, bright ones lighter than normal,
  white light and black dark in both themes so white-on-red/blue/magenta
  and black-on-green/yellow/cyan (ls setuid, setgid, sticky) keep 3:1.
  Selection, find matches and the current match keep text at 4.5:1.
- Bottom panel opens at 40% of the window, at least 16 rows, until
  dragged; the dragged height is remembered (old saved 300 px default
  reads as never resized).
- Navigation rail scrolls its tabs (and below 240 px Settings too), so
  items never overlap under a tall panel.
- Chat command cards: Expand / Collapse grows a live terminal to 60% of
  the window (finished output only to its rows); collapsed stays 12 rows.
- Terminal tabs: ellipsised titles (220 px) with the whole title in the
  tooltip, selected tab filled, outlined and bold, close buttons are
  IconButtons (48 px touch, 40 px desktop).
- Capture fixture: ?terminalColors=1 and ?terminalPalette=.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-26 02:25:16 +00:00
parent e526150b1e
commit b59ab5fad7
27 changed files with 1141 additions and 145 deletions
+62
View File
@@ -266,6 +266,68 @@ void main() {
expect(find.text('count 1'), findsOneWidget, reason: '$width');
}
});
// A tall terminal panel leaves the app (and the rail beside it) as little
// as 160 px: the tabs scroll, and below the pinned height Settings scrolls
// with them, so no two items ever overlap.
for (final height in const [160.0, 200.0, 260.0, 340.0, 420.0, 800.0]) {
testWidgets('a rail ${height.round()} px tall never overlaps its items', (
tester,
) async {
await pumpShell(tester, width: 1000, height: height);
expect(tester.takeException(), isNull);
final keys = [
for (final destination in [
...shellTabDestinations,
AppDestination.settings,
])
ValueKey('shell.destination.${destination.name}'),
];
// What shows of each: the scrolling group clips what is scrolled
// away.
final viewport = tester.getRect(
find.descendant(
of: find.byType(NavigationRail),
matching: find.byType(SingleChildScrollView),
),
);
Rect shown(Key key) {
final finder = find.byKey(key).first;
final rect = tester.getRect(finder);
final scrolls = find
.ancestor(of: finder, matching: find.byType(SingleChildScrollView))
.evaluate()
.isNotEmpty;
return scrolls ? rect.intersect(viewport) : rect;
}
final rects = [for (final key in keys) shown(key)];
for (var i = 0; i < rects.length; i++) {
for (var j = i + 1; j < rects.length; j++) {
expect(
rects[i].overlaps(rects[j]) &&
!rects[i].isEmpty &&
!rects[j].isEmpty,
isFalse,
reason: '${keys[i]} and ${keys[j]} at $height',
);
}
}
// Settings stays reachable: scrolled to, it is on screen and tappable.
await tester.dragUntilVisible(
find.byKey(keys.last),
find.descendant(
of: find.byType(NavigationRail),
matching: find.byType(SingleChildScrollView),
),
const Offset(0, -40),
);
expect(
tester.getRect(find.byKey(keys.last)).bottom,
lessThanOrEqualTo(height + 0.5),
);
});
}
}
class _Counter extends StatefulWidget {