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
+57 -69
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/features/runs/data/runs_repository.dart';
@@ -36,7 +35,7 @@ void main() {
.first,
);
Future<void> pumpSplitRun(WidgetTester tester, bool cupertino) async {
Future<void> pumpSplitRun(WidgetTester tester) async {
tester.view.physicalSize = const Size(1200, 800);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
@@ -45,7 +44,6 @@ void main() {
addTearDown(controller.dispose);
await controller.select(77);
final shell = AdaptiveShell(
cupertino: cupertino,
destination: AppDestination.runs,
destinationBodies: {
AppDestination.runs: (_) => ListDetailPanes(
@@ -65,78 +63,68 @@ void main() {
},
);
await tester.pumpWidget(
cupertino
? CupertinoApp(home: shell)
: MaterialApp(
theme: ThemeData(platform: TargetPlatform.android),
home: shell,
),
MaterialApp(
theme: ThemeData(platform: TargetPlatform.android),
home: shell,
),
);
await tester.pumpAndSettle();
}
for (final cupertino in [false, true]) {
final host = cupertino ? 'Cupertino' : 'Material';
testWidgets('1200: run tabs float at the pane\'s bottom beside the '
'shell bar under the list, and the stage page opens in the pane', (
tester,
) async {
await pumpSplitRun(tester);
final body = tester.getRect(find.byKey(const ValueKey('list-detail-body')));
final list = tester.getRect(find.byKey(const ValueKey('list-detail-list')));
var main = shellPill(tester);
expect(main.left, closeTo(list.left + kFloatingBarMargin, 0.5));
expect(main.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
testWidgets('$host 1200: run tabs float at the pane\'s bottom beside the '
'shell bar under the list, and the stage page opens in the pane', (
final runTabs = pillOf(tester, find.byKey(const Key('run-detail-tabs')));
expect(runTabs.left, greaterThanOrEqualTo(body.left));
expect(runTabs.right, closeTo(1200 - kFloatingBarMargin, 0.5));
expect(runTabs.overlaps(main), isFalse);
expect(runTabs.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
// Open the stage page from the timeline.
await openRunDetailTab(tester, RunDetailTab.timeline);
final row = find.byKey(const ValueKey('run-timeline-visit-1'));
await tester.ensureVisible(row);
await tester.pumpAndSettle();
await tester.tap(row);
await tester.pumpAndSettle();
expect(find.byKey(const Key('run-visit-back')), findsOneWidget);
// The page covers only the detail pane: the root navigator has nothing
// pushed, and the list and the shell's tab bar stay in place.
expect(
tester.state<NavigatorState>(find.byType(Navigator).first).canPop(),
isFalse,
);
expect(find.text('run row 0'), findsOneWidget);
final back = tester.getRect(find.byKey(const Key('run-visit-back')));
expect(back.left, greaterThanOrEqualTo(body.left));
main = shellPill(tester);
expect(main.left, closeTo(list.left + kFloatingBarMargin, 0.5));
final visitTabs = pillOf(
tester,
) async {
await pumpSplitRun(tester, cupertino);
final body = tester.getRect(
find.byKey(const ValueKey('list-detail-body')),
);
final list = tester.getRect(
find.byKey(const ValueKey('list-detail-list')),
);
var main = shellPill(tester);
expect(main.left, closeTo(list.left + kFloatingBarMargin, 0.5));
expect(main.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
find.byKey(const Key('run-visit-tabs')).last,
);
expect(visitTabs.left, greaterThanOrEqualTo(body.left));
expect(visitTabs.overlaps(main), isFalse);
expect(visitTabs.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
expect(tester.takeException(), isNull);
final runTabs = pillOf(tester, find.byKey(const Key('run-detail-tabs')));
expect(runTabs.left, greaterThanOrEqualTo(body.left));
expect(runTabs.right, closeTo(1200 - kFloatingBarMargin, 0.5));
expect(runTabs.overlaps(main), isFalse);
expect(runTabs.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
// The shell's tabs still work over the open stage page.
await tester.tap(find.byKey(const ValueKey('shell.destination.runs')));
await tester.pumpAndSettle();
// Open the stage page from the timeline.
await openRunDetailTab(tester, RunDetailTab.timeline);
final row = find.byKey(const ValueKey('run-timeline-visit-1'));
await tester.ensureVisible(row);
await tester.pumpAndSettle();
await tester.tap(row);
await tester.pumpAndSettle();
expect(find.byKey(const Key('run-visit-back')), findsOneWidget);
// The page covers only the detail pane: the root navigator has nothing
// pushed, and the list and the shell's tab bar stay in place.
expect(
tester.state<NavigatorState>(find.byType(Navigator).first).canPop(),
isFalse,
);
expect(find.text('run row 0'), findsOneWidget);
final back = tester.getRect(find.byKey(const Key('run-visit-back')));
expect(back.left, greaterThanOrEqualTo(body.left));
main = shellPill(tester);
expect(main.left, closeTo(list.left + kFloatingBarMargin, 0.5));
final visitTabs = pillOf(
tester,
find.byKey(const Key('run-visit-tabs')).last,
);
expect(visitTabs.left, greaterThanOrEqualTo(body.left));
expect(visitTabs.overlaps(main), isFalse);
expect(visitTabs.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
expect(tester.takeException(), isNull);
// The shell's tabs still work over the open stage page.
await tester.tap(find.byKey(const ValueKey('shell.destination.runs')));
await tester.pumpAndSettle();
// Back closes the page inside the pane, back to the run.
await tester.tap(find.byKey(const Key('run-visit-back')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('run-visit-back')), findsNothing);
expect(find.byKey(const Key('run-detail-tabs')), findsOneWidget);
});
}
// Back closes the page inside the pane, back to the run.
await tester.tap(find.byKey(const Key('run-visit-back')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('run-visit-back')), findsNothing);
expect(find.byKey(const Key('run-detail-tabs')), findsOneWidget);
});
}