Remove Cupertino UI branches

Keep the public Cupertino-compatible parameters while retaining only the Material implementations and tests. The app is Material-only, so deleting unreachable Cupertino branches reduces dead code without changing the active path.
This commit is contained in:
2026-11-11 02:41:26 +00:00
parent 37cf9472c2
commit 9adee6cc60
29 changed files with 865 additions and 1744 deletions
@@ -294,59 +294,46 @@ void main() {
expect(tester.takeException(), isNull);
});
for (final cupertino in [false, true]) {
testWidgets('a file opens as a page that steps to the previous and next '
'file (${cupertino ? 'cupertino' : 'material'})', (tester) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
final viewer = ChangesViewer(
steps: [
stepFixture(
fileChanges: captureFixture(
files: [
fileChangeFixture(
path: 'lib/first.dart',
patch: multiHunkPatch,
),
fileChangeFixture(
path: 'lib/second.dart',
patch: multiHunkPatch,
),
],
),
testWidgets('a file opens as a page that steps to the previous and next '
'file', (tester) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
final viewer = ChangesViewer(
steps: [
stepFixture(
fileChanges: captureFixture(
files: [
fileChangeFixture(path: 'lib/first.dart', patch: multiHunkPatch),
fileChangeFixture(path: 'lib/second.dart', patch: multiHunkPatch),
],
),
],
);
await tester.pumpWidget(
cupertino ? cupertinoHost(viewer) : materialHost(viewer),
);
await tester.tap(find.byKey(const ValueKey('change-1-lib/first.dart')));
await tester.pumpAndSettle();
),
],
);
await tester.pumpWidget(materialHost(viewer));
await tester.tap(find.byKey(const ValueKey('change-1-lib/first.dart')));
await tester.pumpAndSettle();
Finder control(String label) =>
cupertino ? find.bySemanticsLabel(label) : find.byTooltip(label);
expect(find.byType(FileDiffPage), findsOneWidget);
expect(find.text('first.dart'), findsOneWidget);
expect(find.text('1 of 2'), findsOneWidget);
// The pager sits at the bottom right.
final pager = tester.getRect(
find.byKey(const ValueKey('file-diff-pager')),
);
expect(pager.bottom, greaterThan(844 - 120));
final next = tester.getRect(control('Next file'));
expect(next.right, greaterThan(390 - 80));
Finder control(String label) => find.byTooltip(label);
expect(find.byType(FileDiffPage), findsOneWidget);
expect(find.text('first.dart'), findsOneWidget);
expect(find.text('1 of 2'), findsOneWidget);
// The pager sits at the bottom right.
final pager = tester.getRect(find.byKey(const ValueKey('file-diff-pager')));
expect(pager.bottom, greaterThan(844 - 120));
final next = tester.getRect(control('Next file'));
expect(next.right, greaterThan(390 - 80));
await tester.tap(control('Next file'));
await tester.pumpAndSettle();
expect(find.text('second.dart'), findsOneWidget);
expect(find.text('2 of 2'), findsOneWidget);
await tester.tap(control('Previous file'));
await tester.pumpAndSettle();
expect(find.text('first.dart'), findsOneWidget);
expect(tester.takeException(), isNull);
});
}
await tester.tap(control('Next file'));
await tester.pumpAndSettle();
expect(find.text('second.dart'), findsOneWidget);
expect(find.text('2 of 2'), findsOneWidget);
await tester.tap(control('Previous file'));
await tester.pumpAndSettle();
expect(find.text('first.dart'), findsOneWidget);
expect(tester.takeException(), isNull);
});
final diffFile = FileChange(
path: 'lib/feature.dart',
@@ -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/core/api_gateway.dart';
@@ -85,33 +84,28 @@ void main() {
expect(next.bottom, greaterThan(844 - 80));
});
for (final host in ['Material', 'Cupertino']) {
for (final size in [
const Size(390, 844),
const Size(880, 1000),
const Size(1100, 800),
]) {
testWidgets('$host pager clears an inherited stacked bar at $size', (
tester,
) async {
tester.view.physicalSize = size;
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
final child = ChangesViewer(steps: twoVisitRun());
final hosted = host == 'Material'
? materialHost(child)
: cupertinoHost(child);
await tester.pumpWidget(
MediaQuery(
data: const MediaQueryData(padding: EdgeInsets.only(bottom: 120)),
child: hosted,
),
);
await tester.pump();
final pager = tester.getRect(find.byKey(ChangesVisitPager.nextKey));
expect(pager.bottom, lessThanOrEqualTo(size.height - 120));
});
}
for (final size in [
const Size(390, 844),
const Size(880, 1000),
const Size(1100, 800),
]) {
testWidgets('Material pager clears an inherited stacked bar at $size', (
tester,
) async {
tester.view.physicalSize = size;
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
final child = ChangesViewer(steps: twoVisitRun());
await tester.pumpWidget(
MediaQuery(
data: const MediaQueryData(padding: EdgeInsets.only(bottom: 120)),
child: materialHost(child),
),
);
await tester.pump();
final pager = tester.getRect(find.byKey(ChangesVisitPager.nextKey));
expect(pager.bottom, lessThanOrEqualTo(size.height - 120));
});
}
testWidgets('paging stops at both ends instead of wrapping', (tester) async {
@@ -220,31 +214,4 @@ void main() {
expect(find.text('Visit 1 · completed'), findsOneWidget);
expect(find.text('lib/c.dart'), findsOneWidget);
});
testWidgets('Cupertino pages with native buttons at both ends', (
tester,
) async {
await tester.pumpWidget(cupertinoHost(ChangesViewer(steps: twoVisitRun())));
final previous = tester.widget<CupertinoButton>(
find.byKey(ChangesVisitPager.previousKey),
);
final next = tester.widget<CupertinoButton>(
find.byKey(ChangesVisitPager.nextKey),
);
expect(previous.onPressed, isNull);
expect(next.onPressed, isNotNull);
expect(find.byKey(ChangesVisitPager.previousKey), findsOneWidget);
expect(find.byKey(ChangesVisitPager.nextKey), findsOneWidget);
await tester.tap(find.byKey(ChangesVisitPager.nextKey));
await tester.pump();
expect(find.text('reviewer'), findsNothing);
expect(
tester
.widget<CupertinoButton>(find.byKey(ChangesVisitPager.nextKey))
.onPressed,
isNull,
);
});
}