Remove Cupertino shell branches

Keep the Material-only shell path while preserving public cupertino parameters for callers. Narrow matching tests to Material hosts and behavior because the app always runs under MaterialApp.
This commit is contained in:
2026-11-11 03:48:41 +00:00
parent baac6eca9a
commit 9bdabb32d9
33 changed files with 1646 additions and 2326 deletions
+176 -192
View File
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/shell/adaptive_shell.dart';
@@ -46,11 +45,11 @@ void main() {
);
/// A detail with its own floating tabs over a list, like run detail.
Widget tabsDetail(bool cupertino) => FloatingBarOverlay(
Widget tabsDetail() => FloatingBarOverlay(
bar: KeyedSubtree(
key: const Key('detail-tabs'),
child: FloatingDestinationBar(
cupertino: cupertino,
cupertino: false,
currentIndex: 0,
onTap: (_) {},
items: const [
@@ -72,7 +71,6 @@ void main() {
);
Widget shell({
required bool cupertino,
bool split = true,
bool tabs = false,
double textScale = 1,
@@ -80,7 +78,6 @@ void main() {
AppDestination destination = AppDestination.chat,
}) {
final app = AdaptiveShell(
cupertino: cupertino,
listPaneWidthStore: store ?? MemoryListPaneWidthStore(),
destination: destination,
destinationBodies: {
@@ -88,7 +85,7 @@ void main() {
AppDestination.chat: (_) => split
? ListDetailPanes(
list: listBody(),
detail: tabs ? tabsDetail(cupertino) : composerDetail(),
detail: tabs ? tabsDetail() : composerDetail(),
)
: listBody(),
},
@@ -97,7 +94,7 @@ void main() {
data: MediaQueryData.fromView(
WidgetsBinding.instance.platformDispatcher.views.first,
).copyWith(textScaler: TextScaler.linear(textScale)),
child: cupertino ? CupertinoApp(home: app) : MaterialApp(home: app),
child: MaterialApp(home: app),
);
}
@@ -110,204 +107,191 @@ void main() {
.first,
);
for (final cupertino in [false, true]) {
final host = cupertino ? 'Cupertino' : 'Material';
for (final width in [1200.0, 1600.0]) {
testWidgets('$width split: the destination bar sits under the '
'list and the composer at the detail\'s bottom edge', (tester) async {
await setSize(tester, Size(width, 800));
await tester.pumpWidget(shell());
await tester.pump();
await tester.pump();
for (final width in [1200.0, 1600.0]) {
testWidgets('$host $width split: the destination bar sits under the '
'list and the composer at the detail\'s bottom edge', (tester) async {
await setSize(tester, Size(width, 800));
await tester.pumpWidget(shell(cupertino: cupertino));
await tester.pump();
await tester.pump();
final list = tester.getRect(
find.byKey(const ValueKey('list-detail-list')),
);
final body = tester.getRect(
find.byKey(const ValueKey('list-detail-body')),
);
final pill = destinationPill(tester);
// 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');
expect(
pill.width,
lessThanOrEqualTo(list.width - 2 * kFloatingBarMargin),
);
for (final destination in shellTabDestinations) {
final caption = find.byKey(
ValueKey(
'destination-label-${destinationDetails(destination).label}',
),
);
expect(caption, findsOneWidget);
expect(pill.contains(tester.getRect(caption).center), isTrue);
}
final list = tester.getRect(
find.byKey(const ValueKey('list-detail-list')),
);
final body = tester.getRect(
find.byKey(const ValueKey('list-detail-body')),
);
final pill = destinationPill(tester);
// 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');
// The composer reaches the detail's bottom edge: nothing is reserved
// there for the shell's bar any more.
final composer = tester.getRect(find.byKey(const Key('composer')));
expect(composer.left, body.left);
expect(composer.bottom, closeTo(800, 0.5));
expect(composer.overlaps(pill), isFalse);
// The list clears the bar, so its last rows scroll out from under it.
final listContext = tester.element(find.byKey(const Key('list')));
expect(
MediaQuery.paddingOf(listContext).bottom,
greaterThanOrEqualTo(800 - pill.top),
);
await tester.drag(find.byKey(const Key('list')), const Offset(0, -4000));
await tester.pumpAndSettle();
final last = tester.getRect(find.text('row 39'));
expect(last.bottom, lessThanOrEqualTo(pill.top));
});
testWidgets('$width split: the item tabs sit at the bottom right '
'of the detail, and its content clears only them', (tester) async {
await setSize(tester, Size(width, 800));
await tester.pumpWidget(shell(tabs: true));
await tester.pump();
await tester.pump();
final body = tester.getRect(
find.byKey(const ValueKey('list-detail-body')),
);
final pill = destinationPill(tester);
final tabs = tester.getRect(
find
.descendant(
of: find.byKey(const Key('detail-tabs')),
matching: find.byKey(FloatingDestinationBar.rowKey),
)
.first,
);
expect(tabs.right, closeTo(width - kFloatingBarMargin, 0.5));
expect(tabs.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
expect(tabs.left, greaterThan(body.left));
expect(tabs.overlaps(pill), isFalse);
// Page tabs retain their dense icon-only presentation; only app
// destinations gain visible captions.
final detailBar = tester.widget<FloatingDestinationBar>(
find.descendant(
of: find.byKey(const Key('detail-tabs')),
matching: find.byType(FloatingDestinationBar),
),
);
expect(detailBar.showLabels, isFalse);
for (final label in ['One', 'Two', 'Three']) {
expect(
pill.width,
lessThanOrEqualTo(list.width - 2 * kFloatingBarMargin),
);
for (final destination in shellTabDestinations) {
final caption = find.byKey(
ValueKey(
'destination-label-${destinationDetails(destination).label}',
),
);
expect(caption, findsOneWidget);
expect(pill.contains(tester.getRect(caption).center), isTrue);
}
// The composer reaches the detail's bottom edge: nothing is reserved
// there for the shell's bar any more.
final composer = tester.getRect(find.byKey(const Key('composer')));
expect(composer.left, body.left);
expect(composer.bottom, closeTo(800, 0.5));
expect(composer.overlaps(pill), isFalse);
// The list clears the bar, so its last rows scroll out from under it.
final listContext = tester.element(find.byKey(const Key('list')));
expect(
MediaQuery.paddingOf(listContext).bottom,
greaterThanOrEqualTo(800 - pill.top),
);
await tester.drag(
find.byKey(const Key('list')),
const Offset(0, -4000),
);
await tester.pumpAndSettle();
final last = tester.getRect(find.text('row 39'));
expect(last.bottom, lessThanOrEqualTo(pill.top));
});
testWidgets('$host $width split: the item tabs sit at the bottom right '
'of the detail, and its content clears only them', (tester) async {
await setSize(tester, Size(width, 800));
await tester.pumpWidget(shell(cupertino: cupertino, tabs: true));
await tester.pump();
await tester.pump();
final body = tester.getRect(
find.byKey(const ValueKey('list-detail-body')),
);
final pill = destinationPill(tester);
final tabs = tester.getRect(
find
.descendant(
of: find.byKey(const Key('detail-tabs')),
matching: find.byKey(FloatingDestinationBar.rowKey),
)
.first,
);
expect(tabs.right, closeTo(width - kFloatingBarMargin, 0.5));
expect(tabs.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
expect(tabs.left, greaterThan(body.left));
expect(tabs.overlaps(pill), isFalse);
// Page tabs retain their dense icon-only presentation; only app
// destinations gain visible captions.
final detailBar = tester.widget<FloatingDestinationBar>(
find.descendant(
of: find.byKey(const Key('detail-tabs')),
matching: find.byType(FloatingDestinationBar),
matching: find.text(label),
),
findsNothing,
);
expect(detailBar.showLabels, isFalse);
for (final label in ['One', 'Two', 'Three']) {
expect(
find.descendant(
of: find.byKey(const Key('detail-tabs')),
matching: find.text(label),
),
findsNothing,
);
}
expect(pill.right, lessThan(body.left));
// The item's list pads its end clear of its own tabs.
final listContext = tester.element(
find.byKey(const Key('detail-list')),
);
expect(
MediaQuery.paddingOf(listContext).bottom,
closeTo(800 - tabs.top, 0.5),
);
});
}
testWidgets('$host 1200 split: the bar follows a dragged list width', (
tester,
) async {
await setSize(tester, const Size(1200, 800));
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));
}
});
expect(pill.right, lessThan(body.left));
testWidgets('$host 1200 Settings: a page without a list keeps the bar '
'at the right edge', (tester) async {
await setSize(tester, const Size(1200, 800));
await tester.pumpWidget(
shell(cupertino: cupertino, destination: AppDestination.settings),
// The item's list pads its end clear of its own tabs.
final listContext = tester.element(find.byKey(const Key('detail-list')));
expect(
MediaQuery.paddingOf(listContext).bottom,
closeTo(800 - tabs.top, 0.5),
);
await tester.pump();
final pill = destinationPill(tester);
expect(pill.right, closeTo(1200 - kFloatingBarMargin, 0.5));
});
}
testWidgets('$host 1200 unsplit: the bar stays under the list column', (
tester,
) async {
await setSize(tester, const Size(1200, 800));
await tester.pumpWidget(shell(cupertino: cupertino, split: false));
await tester.pump();
testWidgets('1200 split: the bar follows a dragged list width', (
tester,
) async {
await setSize(tester, const Size(1200, 800));
for (final width in [300.0, 520.0]) {
final store = MemoryListPaneWidthStore({'chat': width});
await tester.pumpWidget(
KeyedSubtree(
key: ValueKey(width),
child: shell(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);
// 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.left, closeTo(kFloatingBarMargin, 0.5));
expect(pill.width, lessThan(1200 * 0.6));
});
testWidgets('$host 390: the bar hugs its tabs at the phone\'s bottom '
'right', (tester) async {
await setSize(tester, const Size(390, 844));
await tester.pumpWidget(shell(cupertino: cupertino, split: false));
await tester.pump();
final pill = destinationPill(tester);
expect(pill.width, lessThanOrEqualTo(390 - 2 * kFloatingBarMargin));
for (final destination in shellTabDestinations) {
expect(
find.byKey(
ValueKey(
'destination-label-${destinationDetails(destination).label}',
),
),
findsOneWidget,
);
}
expect(pill.right, closeTo(390 - kFloatingBarMargin, 0.5));
});
for (final width in [600.0, 840.0]) {
testWidgets('$host $width split at 2x: the bar fits the list pane and '
'the item tabs the detail, without overflow', (tester) async {
await setSize(tester, Size(width, 800));
await tester.pumpWidget(
shell(cupertino: cupertino, tabs: true, textScale: 2),
);
await tester.pump();
await tester.pump();
expect(tester.takeException(), isNull);
final list = tester.getRect(
find.byKey(const ValueKey('list-detail-list')),
);
final pill = destinationPill(tester);
expect(pill.left, greaterThanOrEqualTo(list.left));
expect(pill.right, lessThanOrEqualTo(list.right));
});
expect(pill.left, closeTo(list.left + kFloatingBarMargin, 0.5));
expect(pill.left, greaterThanOrEqualTo(kFloatingBarMargin - 0.5));
expect(pill.right, lessThanOrEqualTo(list.right - kFloatingBarMargin));
}
});
testWidgets('1200 Settings: a page without a list keeps the bar '
'at the right edge', (tester) async {
await setSize(tester, const Size(1200, 800));
await tester.pumpWidget(shell(destination: AppDestination.settings));
await tester.pump();
final pill = destinationPill(tester);
expect(pill.right, closeTo(1200 - kFloatingBarMargin, 0.5));
});
testWidgets('1200 unsplit: the bar stays under the list column', (
tester,
) async {
await setSize(tester, const Size(1200, 800));
await tester.pumpWidget(shell(split: false));
await tester.pump();
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.left, closeTo(kFloatingBarMargin, 0.5));
expect(pill.width, lessThan(1200 * 0.6));
});
testWidgets('390: the bar hugs its tabs at the phone\'s bottom '
'right', (tester) async {
await setSize(tester, const Size(390, 844));
await tester.pumpWidget(shell(split: false));
await tester.pump();
final pill = destinationPill(tester);
expect(pill.width, lessThanOrEqualTo(390 - 2 * kFloatingBarMargin));
for (final destination in shellTabDestinations) {
expect(
find.byKey(
ValueKey(
'destination-label-${destinationDetails(destination).label}',
),
),
findsOneWidget,
);
}
expect(pill.right, closeTo(390 - kFloatingBarMargin, 0.5));
});
for (final width in [600.0, 840.0]) {
testWidgets('$width split at 2x: the bar fits the list pane and '
'the item tabs the detail, without overflow', (tester) async {
await setSize(tester, Size(width, 800));
await tester.pumpWidget(shell(tabs: true, textScale: 2));
await tester.pump();
await tester.pump();
expect(tester.takeException(), isNull);
final list = tester.getRect(
find.byKey(const ValueKey('list-detail-list')),
);
final pill = destinationPill(tester);
expect(pill.left, greaterThanOrEqualTo(list.left));
expect(pill.right, lessThanOrEqualTo(list.right));
});
}
}