Restore requested navigation and mobile chat controls

This commit is contained in:
2026-11-07 22:55:09 +00:00
11 changed files with 151 additions and 137 deletions
@@ -38,7 +38,7 @@ void _useNarrowText(WidgetTester tester) {
}
void main() {
testWidgets('short large-text header scrolls controls without overflow', (
testWidgets('short large-text header keeps controls in its single row', (
tester,
) async {
_useNarrowText(tester);
@@ -55,15 +55,9 @@ void main() {
onInfo: () {},
showBack: true,
onBack: () {},
controls: [
TextButton(
onPressed: () {},
child: const Text('Current model'),
),
TextButton(
onPressed: () {},
child: const Text('Ask for permission'),
),
controls: const [
IconButton(onPressed: null, icon: Icon(Icons.memory_outlined)),
IconButton(onPressed: null, icon: Icon(Icons.shield_outlined)),
],
),
),
@@ -73,9 +67,10 @@ void main() {
);
await tester.pumpAndSettle();
expect(tester.takeException(), isNull);
await tester.ensureVisible(find.text('Ask for permission'));
await tester.pumpAndSettle();
expect(find.text('Ask for permission').hitTestable(), findsOneWidget);
expect(
find.byKey(const Key('chat-model-permission-island')),
findsOneWidget,
);
expect(tester.takeException(), isNull);
});
@@ -83,7 +78,7 @@ void main() {
final host = cupertino ? 'Cupertino' : 'Material';
testWidgets(
'$host narrow header keeps native back/title and readable model',
'$host narrow header keeps native back/title and compact model icon',
(tester) async {
_useNarrowText(tester);
final semantics = tester.ensureSemantics();
@@ -124,19 +119,22 @@ void main() {
// One floating row of separate pieces: the round Back, the title pill
// (which is the information control and holds the title), then the
// model in the trailing pill.
// selector island in the trailing row.
double centerY(Finder finder) => tester.getCenter(finder).dy;
expect((centerY(back) - centerY(info)).abs(), lessThan(16));
expect(
tester.getTopLeft(model).dy,
greaterThanOrEqualTo(tester.getBottomLeft(info).dy),
);
expect((centerY(model) - centerY(info)).abs(), lessThan(16));
expect(find.descendant(of: info, matching: title), findsOneWidget);
double right(Finder finder) => tester.getTopRight(finder).dx;
expect(right(back), lessThanOrEqualTo(tester.getTopLeft(info).dx));
expect(find.byIcon(Icons.memory_outlined), findsOneWidget);
if (!cupertino) {
final semantics = tester.getSemantics(model);
expect(semantics.label, contains('Change model'));
expect(semantics.label, contains('currently'));
}
expect(
find.textContaining('an-extremely-long-recorded-model-id'),
findsOneWidget,
findsNothing,
);
await tester.tap(back);
@@ -199,21 +197,43 @@ void main() {
final actions = find.byKey(const Key('chat-actions-island'));
expect(selectors, findsOneWidget);
expect(actions, findsOneWidget);
if (width / 2 >= 800) {
expect(
tester.getTopRight(selectors).dx,
lessThan(tester.getTopLeft(actions).dx),
);
} else {
expect(
tester.getTopLeft(selectors).dy,
greaterThanOrEqualTo(tester.getBottomLeft(actions).dy),
);
}
expect(
(tester.getCenter(selectors).dy - tester.getCenter(actions).dy)
.abs(),
lessThan(16),
);
expect(find.byKey(const Key('chat-next')), findsNothing);
expect(find.text('Next chat'), findsNothing);
expect(find.byKey(const Key('chat-model')), findsOneWidget);
expect(find.byKey(const Key('chat-mode')), findsOneWidget);
if (width < 600) {
expect(find.text('model-a'), findsNothing);
expect(find.text('Ask before making changes'), findsNothing);
expect(find.byIcon(Icons.memory_outlined), findsOneWidget);
expect(
find.byIcon(
cupertino
? CupertinoIcons.shield_lefthalf_fill
: Icons.shield_outlined,
),
findsOneWidget,
);
if (!cupertino) {
expect(
tester.getSemantics(find.byKey(const Key('chat-model'))).label,
contains('Change model, currently'),
);
expect(
tester.getSemantics(find.byKey(const Key('chat-mode'))).label,
contains('Change mode, currently'),
);
}
expect(
(tester.getCenter(selectors).dy - tester.getCenter(actions).dy)
.abs(),
lessThan(16),
);
}
for (final key in ['chat-model', 'chat-mode']) {
expect(
tester.getSize(find.byKey(Key(key))).width,
+7 -14
View File
@@ -6,9 +6,11 @@ import 'package:pipelines_app/shell/adaptive_shell.dart';
import 'package:pipelines_app/shell/destination.dart';
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
import 'package:pipelines_app/ui/adaptive/floating_destination_labels.dart';
import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart';
/// Main navigation keeps visible captions and full-size targets, floating at
/// the trailing edge on a phone and centered under the list on a wide window.
/// the trailing edge on a phone and the leading edge under the list on a wide
/// window.
void main() {
Finder pill() => find.descendant(
of: find.byType(FloatingDestinationBar),
@@ -110,7 +112,7 @@ void main() {
expect(find.text('Chat — Not implemented'), findsOneWidget);
});
testWidgets('$host: wide bar hugs its tabs under the list column, content '
testWidgets('$host: wide leading bar under the list, content '
'keeps the width and taps beside the bar reach it', (tester) async {
taps = 0;
await setSize(tester, const Size(1200, 800));
@@ -118,13 +120,7 @@ void main() {
final rect = tester.getRect(pill());
// With no item open the bar still sits under the list column, where it
// sits beside an open item, so it never jumps sides.
expect(
rect.center.dx,
moreOrLessEquals(
listDetailListWidth(1200, 1200, null) / 2,
epsilon: 0.5,
),
);
expect(rect.left, moreOrLessEquals(kFloatingBarMargin, epsilon: 0.5));
expect(rect.bottom, 800 - 16);
expect(rect.width, lessThan(1200 * 0.6));
// Captions participate in the bar's content-driven width.
@@ -179,11 +175,8 @@ void main() {
tester.view.physicalSize = const Size(1200, 800);
await tester.pump();
expect(
tester.getRect(pill()).center.dx,
moreOrLessEquals(
listDetailListWidth(1200, 1200, null) / 2,
epsilon: 0.5,
),
tester.getRect(pill()).left,
moreOrLessEquals(kFloatingBarMargin, epsilon: 0.5),
);
expect(tester.getRect(pill()).width, lessThan(1200 * 0.6));
expect(tester.state(find.byType(StatefulBuilder)), same(state));
+23 -19
View File
@@ -9,8 +9,8 @@ import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart';
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
/// While a tab shows its list beside an open item, the shell's destination
/// bar moves to the bottom of the list pane, centred in the list's (dragged)
/// width. The list clears the bar; the item keeps its whole height, its own
/// bar moves to the leading edge at the bottom of the list pane, including
/// after the list's width is dragged. The list clears the bar; the item keeps its whole height, its own
/// bottom control (its tabs, or a composer) at its bottom edge.
void main() {
Future<void> setSize(WidgetTester tester, Size size) async {
@@ -128,8 +128,8 @@ void main() {
find.byKey(const ValueKey('list-detail-body')),
);
final pill = destinationPill(tester);
// Centred at the bottom of the list pane, never over the detail.
expect(pill.center.dx, closeTo(list.center.dx, 0.5));
// Leading at the bottom of the list pane, never over the detail.
expect(pill.left, closeTo(list.left + kFloatingBarMargin, 0.5));
expect(pill.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
expect(pill.right, lessThanOrEqualTo(list.right));
expect(pill.overlaps(body), isFalse, reason: 'never over the detail');
@@ -227,17 +227,24 @@ void main() {
tester,
) async {
await setSize(tester, const Size(1200, 800));
final store = MemoryListPaneWidthStore({'chat': 300});
await tester.pumpWidget(shell(cupertino: cupertino, store: store));
await tester.pumpAndSettle();
final list = tester.getRect(
find.byKey(const ValueKey('list-detail-list')),
);
expect(list.width, closeTo(300, 0.5));
final pill = destinationPill(tester);
expect(pill.center.dx, closeTo(list.center.dx, 0.5));
expect(pill.left, greaterThanOrEqualTo(kFloatingBarMargin - 0.5));
expect(pill.right, lessThanOrEqualTo(list.right - kFloatingBarMargin));
for (final width in [300.0, 520.0]) {
final store = MemoryListPaneWidthStore({'chat': width});
await tester.pumpWidget(
KeyedSubtree(
key: ValueKey(width),
child: shell(cupertino: cupertino, store: store),
),
);
await tester.pumpAndSettle();
final list = tester.getRect(
find.byKey(const ValueKey('list-detail-list')),
);
expect(list.width, closeTo(width, 0.5));
final pill = destinationPill(tester);
expect(pill.left, closeTo(list.left + kFloatingBarMargin, 0.5));
expect(pill.left, greaterThanOrEqualTo(kFloatingBarMargin - 0.5));
expect(pill.right, lessThanOrEqualTo(list.right - kFloatingBarMargin));
}
});
testWidgets('$host 1200 Settings: a page without a list keeps the bar '
@@ -260,10 +267,7 @@ void main() {
final pill = destinationPill(tester);
// Same place as beside an open item (Search has no split), so opening
// or closing an item never moves the bar across the window.
expect(
pill.center.dx,
closeTo(listDetailListWidth(1200, 1200, null) / 2, 0.5),
);
expect(pill.left, closeTo(kFloatingBarMargin, 0.5));
expect(pill.width, lessThan(1200 * 0.6));
});