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
+81 -88
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';
@@ -6,9 +5,8 @@ import 'package:pipelines_app/shell/destination.dart';
import 'package:pipelines_app/shell/shell_bar.dart';
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
Widget _app({required bool cupertino, required bool open, VoidCallback? back}) {
Widget _app({required bool open, VoidCallback? back}) {
final shell = AdaptiveShell(
cupertino: cupertino,
destination: AppDestination.runs,
destinationBodies: {
AppDestination.runs: (_) => open
@@ -21,102 +19,97 @@ Widget _app({required bool cupertino, required bool open, VoidCallback? back}) {
: const Text('list'),
},
);
return cupertino ? CupertinoApp(home: shell) : MaterialApp(home: shell);
return MaterialApp(home: shell);
}
void main() {
for (final cupertino in [false, true]) {
final host = cupertino ? 'cupertino' : 'material';
testWidgets('$host: an open screen takes over the bar and gives it back', (
tester,
) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
var backs = 0;
await tester.pumpWidget(
_app(cupertino: cupertino, open: true, back: () => backs++),
);
await tester.pump();
testWidgets('an open screen takes over the bar and gives it back', (
tester,
) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
var backs = 0;
await tester.pumpWidget(_app(open: true, back: () => backs++));
await tester.pump();
expect(find.text('Run 7'), findsOneWidget);
expect(find.byKey(const Key('run-more')), findsOneWidget);
await tester.tap(find.byKey(const ValueKey('shell.back')));
expect(backs, 1);
expect(find.text('Run 7'), findsOneWidget);
expect(find.byKey(const Key('run-more')), findsOneWidget);
await tester.tap(find.byKey(const ValueKey('shell.back')));
expect(backs, 1);
await tester.pumpWidget(_app(cupertino: cupertino, open: false));
await tester.pump();
expect(find.text('Run 7'), findsNothing);
expect(find.byKey(const ValueKey('shell.back')), findsNothing);
expect(find.byKey(const Key('run-more')), findsNothing);
});
await tester.pumpWidget(_app(open: false));
await tester.pump();
expect(find.text('Run 7'), findsNothing);
expect(find.byKey(const ValueKey('shell.back')), findsNothing);
expect(find.byKey(const Key('run-more')), findsNothing);
});
testWidgets('$host: Search is the fourth tab; Settings is not a tab', (
tester,
) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(_app(cupertino: cupertino, open: false));
expect(AppDestination.values, hasLength(5));
expect(shellTabDestinations, [
AppDestination.pipelines,
AppDestination.runs,
AppDestination.chat,
AppDestination.search,
]);
expect(
find.byKey(const ValueKey('shell.destination.search')),
findsOneWidget,
);
expect(
find.byKey(const ValueKey('shell.destination.settings')),
findsNothing,
);
expect(find.byKey(const ValueKey('shell.search')), findsNothing);
expect(find.byType(FloatingDestinationBar), findsOneWidget);
});
testWidgets('Search is the fourth tab; Settings is not a tab', (
tester,
) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(_app(open: false));
expect(AppDestination.values, hasLength(5));
expect(shellTabDestinations, [
AppDestination.pipelines,
AppDestination.runs,
AppDestination.chat,
AppDestination.search,
]);
expect(
find.byKey(const ValueKey('shell.destination.search')),
findsOneWidget,
);
expect(
find.byKey(const ValueKey('shell.destination.settings')),
findsNothing,
);
expect(find.byKey(const ValueKey('shell.search')), findsNothing);
expect(find.byType(FloatingDestinationBar), findsOneWidget);
});
testWidgets('$host: floating tabs stay inset and select destinations', (
tester,
) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(_app(cupertino: cupertino, open: false));
testWidgets('floating tabs stay inset and select destinations', (
tester,
) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(_app(open: false));
final destinationPill = find.descendant(
final destinationPill = find.descendant(
of: find.byType(FloatingDestinationBar),
matching: find.byKey(FloatingDestinationBar.rowKey),
);
// Visible captions determine the width while full-size targets stay inset.
final rect = tester.getRect(destinationPill);
expect(rect.width, lessThanOrEqualTo(390 - 2 * 16));
expect(
tester
.widget<FloatingDestinationBar>(find.byType(FloatingDestinationBar))
.showLabels,
isTrue,
);
for (final destination in shellTabDestinations) {
final caption = find.descendant(
of: find.byType(FloatingDestinationBar),
matching: find.byKey(FloatingDestinationBar.rowKey),
matching: find.text(destinationDetails(destination).label),
);
// Visible captions determine the width while full-size targets stay inset.
final rect = tester.getRect(destinationPill);
expect(rect.width, lessThanOrEqualTo(390 - 2 * 16));
expect(
tester
.widget<FloatingDestinationBar>(find.byType(FloatingDestinationBar))
.showLabels,
isTrue,
expect(caption, findsOneWidget);
expect(rect.contains(tester.getRect(caption).center), isTrue);
final target = tester.getSize(
find.byKey(ValueKey('shell.destination.${destination.name}')),
);
for (final destination in shellTabDestinations) {
final caption = find.descendant(
of: find.byType(FloatingDestinationBar),
matching: find.text(destinationDetails(destination).label),
);
expect(caption, findsOneWidget);
expect(rect.contains(tester.getRect(caption).center), isTrue);
final target = tester.getSize(
find.byKey(ValueKey('shell.destination.${destination.name}')),
);
expect(target.width, greaterThanOrEqualTo(44));
expect(target.height, greaterThanOrEqualTo(44));
}
expect(tester.getRect(destinationPill).right, 390 - 16);
await tester.tap(find.byKey(const ValueKey('shell.destination.chat')));
await tester.pump();
expect(find.text('Chat — Not implemented'), findsOneWidget);
});
}
expect(target.width, greaterThanOrEqualTo(44));
expect(target.height, greaterThanOrEqualTo(44));
}
expect(tester.getRect(destinationPill).right, 390 - 16);
await tester.tap(find.byKey(const ValueKey('shell.destination.chat')));
await tester.pump();
expect(find.text('Chat — Not implemented'), findsOneWidget);
});
testWidgets('tabs show the running and unread counts their screens publish', (
tester,