Remove Cupertino branches from runs UI

Keep the Material-only run detail implementation while preserving public parameters for callers. Narrow the corresponding widget tests to the supported Material host and remove unused Cupertino-only code.
This commit is contained in:
2026-11-11 05:11:26 +00:00
parent 591e1eec3a
commit 75929a0a41
26 changed files with 568 additions and 1121 deletions
@@ -1,6 +1,5 @@
import 'dart:ui' show SemanticsRole;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/pipelines/widgets/pipeline_tabs.dart';
@@ -15,12 +14,11 @@ import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
/// test key; the icons within a bar, and against the shell's tabs a detail's
/// bar floats above, are distinct.
void main() {
Widget host(bool cupertino, Widget bar) {
final body = Align(alignment: Alignment.bottomCenter, child: bar);
return cupertino
? CupertinoApp(home: CupertinoPageScaffold(child: body))
: MaterialApp(home: Scaffold(body: body));
}
Widget host(Widget bar) => MaterialApp(
home: Scaffold(
body: Align(alignment: Alignment.bottomCenter, child: bar),
),
);
final bars = <String, (Widget, List<(String, String)>)>{
'run detail': (
@@ -52,82 +50,69 @@ void main() {
),
};
for (final cupertino in [false, true]) {
final name = cupertino ? 'Cupertino' : 'Material';
for (final MapEntry(key: label, value: (bar, tabs)) in bars.entries) {
testWidgets('$name $label tabs are icons named for assistive '
'technology', (tester) async {
final semantics = tester.ensureSemantics();
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(host(cupertino, bar));
await tester.pumpAndSettle();
for (final MapEntry(key: label, value: (bar, tabs)) in bars.entries) {
testWidgets('$label tabs are icons named for assistive '
'technology', (tester) async {
final semantics = tester.ensureSemantics();
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(host(bar));
await tester.pumpAndSettle();
final floating = find.byType(FloatingDestinationBar);
// No label is drawn at all.
final floating = find.byType(FloatingDestinationBar);
// No label is drawn at all.
expect(
find.descendant(of: floating, matching: find.byType(Text)),
findsNothing,
);
for (final (index, (key, tabLabel)) in tabs.indexed) {
final finder = find.byKey(ValueKey(key));
final node = tester.getSemantics(finder);
expect(node.label, startsWith(tabLabel), reason: key);
expect(
find.descendant(of: floating, matching: find.byType(Text)),
findsNothing,
node,
isSemantics(
isSelected: index == 0,
hasSelectedState: true,
isButton: true,
hasTapAction: true,
),
reason: key,
);
for (final (index, (key, tabLabel)) in tabs.indexed) {
final finder = find.byKey(ValueKey(key));
final node = tester.getSemantics(finder);
expect(node.label, startsWith(tabLabel), reason: key);
expect(
node,
isSemantics(
isSelected: index == 0,
hasSelectedState: true,
isButton: true,
hasTapAction: true,
expect(node.role, SemanticsRole.tab, reason: key);
// "Tab n of m", as the host navigation controls announce it.
final position = 'Tab ${index + 1} of ${tabs.length}';
expect(node.label, contains(position), reason: key);
// Material names the tab in its tooltip too.
expect(
find.descendant(
of: finder,
matching: find.byWidgetPredicate(
(widget) => widget is Tooltip && widget.message == tabLabel,
),
reason: key,
);
expect(node.role, SemanticsRole.tab, reason: key);
// "Tab n of m", as the host navigation controls announce it: in the
// Material label, the Cupertino hint.
final position = 'Tab ${index + 1} of ${tabs.length}';
expect(
cupertino ? node.hint : node.label,
contains(position),
reason: key,
);
// Material names the tab in its tooltip too.
if (!cupertino) {
expect(
find.descendant(
of: finder,
matching: find.byWidgetPredicate(
(widget) => widget is Tooltip && widget.message == tabLabel,
),
),
findsOneWidget,
reason: key,
);
}
// A hit target at least the platform minimum.
expect(
tester.getSize(finder).shortestSide,
greaterThanOrEqualTo(cupertino ? 44 : 48),
);
}
// The tabs make up one tab bar.
final tabBar = tester.getSemantics(
find.byKey(FloatingDestinationBar.rowKey),
),
findsOneWidget,
reason: key,
);
expect(tabBar.role, SemanticsRole.tabBar);
// Distinct glyphs within the bar.
final icons = tester
.widgetList<Icon>(
find.descendant(of: floating, matching: find.byType(Icon)),
)
.map((icon) => icon.icon)
.toSet();
expect(icons.length, greaterThanOrEqualTo(tabs.length));
semantics.dispose();
});
}
// A hit target at least the platform minimum.
expect(tester.getSize(finder).shortestSide, greaterThanOrEqualTo(48));
}
// The tabs make up one tab bar.
final tabBar = tester.getSemantics(
find.byKey(FloatingDestinationBar.rowKey),
);
expect(tabBar.role, SemanticsRole.tabBar);
// Distinct glyphs within the bar.
final icons = tester
.widgetList<Icon>(
find.descendant(of: floating, matching: find.byType(Icon)),
)
.map((icon) => icon.icon)
.toSet();
expect(icons.length, greaterThanOrEqualTo(tabs.length));
semantics.dispose();
});
}
test('detail tab icons differ from the shell tabs they float above', () {