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
+84 -103
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';
@@ -50,9 +49,8 @@ void main() {
),
);
Widget app({required bool cupertino, required bool split}) {
Widget app({required bool split}) {
final shell = AdaptiveShell(
cupertino: cupertino,
destinationBodies: {
AppDestination.runs: (_) => split
? ListDetailPanes(
@@ -69,9 +67,7 @@ void main() {
);
Widget margins(BuildContext context, Widget? child) =>
WindowMargins(child: child!);
return cupertino
? CupertinoApp(builder: margins, home: shell)
: MaterialApp(builder: margins, home: shell);
return MaterialApp(builder: margins, home: shell);
}
Finder pills(Finder bar) =>
@@ -94,107 +90,92 @@ void main() {
return rects.reduce((a, b) => a.expandToInclude(b));
}
for (final cupertino in [false, true]) {
final host = cupertino ? 'Cupertino' : 'Material';
testWidgets('1280: list and detail bars keep 16 px from the top '
'and every side', (tester) async {
await setSize(tester, const Size(1280, 800));
await tester.pumpWidget(app(split: true));
await tester.pump();
// The pieces pop in; measure them at rest.
await tester.pump(const Duration(seconds: 2));
testWidgets('$host 1280: list and detail bars keep 16 px from the top '
'and every side', (tester) async {
await setSize(tester, const Size(1280, 800));
await tester.pumpWidget(app(cupertino: cupertino, split: true));
await tester.pump();
// The pieces pop in; measure them at rest.
await tester.pump(const Duration(seconds: 2));
final listPane = tester.getRect(
find.byKey(const ValueKey('list-detail-list')),
);
final body = tester.getRect(find.byKey(const ValueKey('list-detail-body')));
final listBar = span(tester, shellBar);
final itemBar = span(tester, paneBar);
expect(listBar.top, closeTo(16, 0.5));
expect(listBar.left, closeTo(listPane.left + 16, 0.5));
expect(listBar.right, closeTo(listPane.right - 16, 0.5));
expect(itemBar.top, closeTo(16, 0.5));
expect(itemBar.left, closeTo(body.left + 16, 0.5));
expect(itemBar.right, closeTo(body.right - 16, 0.5));
final listPane = tester.getRect(
find.byKey(const ValueKey('list-detail-list')),
);
final body = tester.getRect(
find.byKey(const ValueKey('list-detail-body')),
);
final listBar = span(tester, shellBar);
final itemBar = span(tester, paneBar);
expect(listBar.top, closeTo(16, 0.5));
expect(listBar.left, closeTo(listPane.left + 16, 0.5));
expect(listBar.right, closeTo(listPane.right - 16, 0.5));
expect(itemBar.top, closeTo(16, 0.5));
expect(itemBar.left, closeTo(body.left + 16, 0.5));
expect(itemBar.right, closeTo(body.right - 16, 0.5));
// Each pane's content still starts below its bar (and its 8 px gap)
// at rest, so nothing hides behind the taller margin.
expect(
tester.getTopLeft(find.text('list row 0')).dy,
greaterThanOrEqualTo(listBar.bottom + 8 - 0.5),
);
expect(
tester.getTopLeft(find.text('item row 0')).dy,
greaterThanOrEqualTo(itemBar.bottom + 8 - 0.5),
);
expect(tester.takeException(), isNull);
});
// Each pane's content still starts below its bar (and its 8 px gap)
// at rest, so nothing hides behind the taller margin.
expect(
tester.getTopLeft(find.text('list row 0')).dy,
greaterThanOrEqualTo(listBar.bottom + 8 - 0.5),
);
expect(
tester.getTopLeft(find.text('item row 0')).dy,
greaterThanOrEqualTo(itemBar.bottom + 8 - 0.5),
);
expect(tester.takeException(), isNull);
});
testWidgets('390: the phone keeps the bar at 8 px from the top and '
'12 px from the sides', (tester) async {
await setSize(tester, const Size(390, 844));
await tester.pumpWidget(app(split: false));
await tester.pump();
// The pieces pop in; measure them at rest.
await tester.pump(const Duration(seconds: 2));
testWidgets('$host 390: the phone keeps the bar at 8 px from the top and '
'12 px from the sides', (tester) async {
await setSize(tester, const Size(390, 844));
await tester.pumpWidget(app(cupertino: cupertino, split: false));
await tester.pump();
// The pieces pop in; measure them at rest.
await tester.pump(const Duration(seconds: 2));
final bar = span(tester, shellBar);
expect(bar.top, closeTo(8, 0.5));
expect(bar.left, closeTo(12, 0.5));
expect(bar.right, closeTo(390 - 12, 0.5));
expect(
tester.getTopLeft(find.text('list row 0')).dy,
greaterThanOrEqualTo(bar.bottom + 8 - 0.5),
);
expect(tester.takeException(), isNull);
});
final bar = span(tester, shellBar);
expect(bar.top, closeTo(8, 0.5));
expect(bar.left, closeTo(12, 0.5));
expect(bar.right, closeTo(390 - 12, 0.5));
expect(
tester.getTopLeft(find.text('list row 0')).dy,
greaterThanOrEqualTo(bar.bottom + 8 - 0.5),
);
expect(tester.takeException(), isNull);
});
testWidgets('1280: a pushed page\'s bar keeps the wide margins', (
tester,
) async {
await setSize(tester, const Size(1280, 800));
final bar = SegmentedBar(
cupertino: false,
title: 'Settings',
actions: const [Icon(Icons.more_vert, semanticLabel: 'More')],
);
final body = Builder(
builder: (context) => ListView(
padding: withTopBarClearance(context, EdgeInsets.zero),
children: const [SizedBox(height: 40, child: Text('first row'))],
),
);
Widget margins(BuildContext context, Widget? child) =>
WindowMargins(child: child!);
await tester.pumpWidget(
MaterialApp(
builder: margins,
home: Scaffold(extendBodyBehindAppBar: true, appBar: bar, body: body),
),
);
await tester.pump(const Duration(seconds: 2));
testWidgets('$host 1280: a pushed page\'s bar keeps the wide margins', (
tester,
) async {
await setSize(tester, const Size(1280, 800));
final bar = SegmentedBar(
cupertino: cupertino,
title: 'Settings',
actions: const [Icon(Icons.more_vert, semanticLabel: 'More')],
);
final body = Builder(
builder: (context) => ListView(
padding: withTopBarClearance(context, EdgeInsets.zero),
children: const [SizedBox(height: 40, child: Text('first row'))],
),
);
Widget margins(BuildContext context, Widget? child) =>
WindowMargins(child: child!);
await tester.pumpWidget(
cupertino
? CupertinoApp(
builder: margins,
home: CupertinoPageScaffold(navigationBar: bar, child: body),
)
: MaterialApp(
builder: margins,
home: Scaffold(
extendBodyBehindAppBar: true,
appBar: bar,
body: body,
),
),
);
await tester.pump(const Duration(seconds: 2));
final pieces = span(tester, find.byType(SegmentedBar));
expect(pieces.top, closeTo(16, 0.5));
expect(pieces.left, closeTo(16, 0.5));
expect(pieces.right, closeTo(1280 - 16, 0.5));
expect(
tester.getTopLeft(find.text('first row')).dy,
closeTo(pieces.bottom + 8, 0.5),
);
expect(tester.takeException(), isNull);
});
}
final pieces = span(tester, find.byType(SegmentedBar));
expect(pieces.top, closeTo(16, 0.5));
expect(pieces.left, closeTo(16, 0.5));
expect(pieces.right, closeTo(1280 - 16, 0.5));
expect(
tester.getTopLeft(find.text('first row')).dy,
closeTo(pieces.bottom + 8, 0.5),
);
expect(tester.takeException(), isNull);
});
}