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
@@ -4,13 +4,11 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/ui/input/app_search_field.dart';
import 'package:pipelines_app/ui/navigation/bar_icon_button.dart';
Widget _row(bool cupertino, List<Widget> children) {
Widget _row(List<Widget> children) {
final row = Center(
child: Row(mainAxisSize: MainAxisSize.min, children: children),
);
return cupertino
? CupertinoApp(home: CupertinoPageScaffold(child: row))
: MaterialApp(home: Scaffold(body: row));
return MaterialApp(home: Scaffold(body: row));
}
BarIconButton _action(Key key, {bool busy = false}) => BarIconButton(
@@ -23,73 +21,58 @@ BarIconButton _action(Key key, {bool busy = false}) => BarIconButton(
);
void main() {
for (final cupertino in [false, true]) {
final host = cupertino ? 'Cupertino' : 'Material';
final side = cupertino
? kMinInteractiveDimensionCupertino
: kMinInteractiveDimension;
const side = kMinInteractiveDimension;
testWidgets('$host bar actions are whole, evenly sized touch targets', (
tester,
) async {
await tester.pumpWidget(
_row(cupertino, [
_action(const ValueKey('a')),
_action(const ValueKey('b')),
_action(const ValueKey('c'), busy: true),
]),
);
for (final key in const ['a', 'b', 'c']) {
expect(tester.getSize(find.byKey(ValueKey(key))), Size(side, side));
}
// Adjacent actions abut: the spacing is the targets', not padding.
expect(
tester.getTopLeft(find.byKey(const ValueKey('b'))).dx -
tester.getTopLeft(find.byKey(const ValueKey('a'))).dx,
side,
);
if (cupertino) expect(find.byType(Material), findsNothing);
expect(find.bySemanticsLabel('Refresh'), findsWidgets);
});
testWidgets('bar actions are whole, evenly sized touch targets', (
tester,
) async {
await tester.pumpWidget(
_row([
_action(const ValueKey('a')),
_action(const ValueKey('b')),
_action(const ValueKey('c'), busy: true),
]),
);
for (final key in const ['a', 'b', 'c']) {
expect(tester.getSize(find.byKey(ValueKey(key))), Size(side, side));
}
// Adjacent actions abut: the spacing is the targets', not padding.
expect(
tester.getTopLeft(find.byKey(const ValueKey('b'))).dx -
tester.getTopLeft(find.byKey(const ValueKey('a'))).dx,
side,
);
expect(find.bySemanticsLabel('Refresh'), findsWidgets);
});
testWidgets('$host search field is one stadium field with a clear', (
tester,
) async {
final text = TextEditingController();
addTearDown(text.dispose);
var cleared = false;
await tester.pumpWidget(
_row(cupertino, [
SizedBox(
width: 300,
child: AppSearchField(
fieldKey: const ValueKey('field'),
controller: text,
placeholder: 'Search',
onCleared: () => cleared = true,
),
testWidgets('search field is one stadium field with a clear', (tester) async {
final text = TextEditingController();
addTearDown(text.dispose);
var cleared = false;
await tester.pumpWidget(
_row([
SizedBox(
width: 300,
child: AppSearchField(
fieldKey: const ValueKey('field'),
controller: text,
placeholder: 'Search',
onCleared: () => cleared = true,
),
]),
);
if (cupertino) {
expect(find.byType(CupertinoSearchTextField), findsOneWidget);
expect(find.byType(Material), findsNothing);
return;
}
final field = tester.widget<TextField>(
find.byKey(const ValueKey('field')),
);
final border = field.decoration!.enabledBorder! as OutlineInputBorder;
expect(border.borderSide, BorderSide.none);
expect(field.decoration!.filled, isTrue);
expect(find.byTooltip('Clear search'), findsNothing);
),
]),
);
final field = tester.widget<TextField>(find.byKey(const ValueKey('field')));
final border = field.decoration!.enabledBorder! as OutlineInputBorder;
expect(border.borderSide, BorderSide.none);
expect(field.decoration!.filled, isTrue);
expect(find.byTooltip('Clear search'), findsNothing);
await tester.enterText(find.byKey(const ValueKey('field')), 'abc');
await tester.pump();
await tester.tap(find.byTooltip('Clear search'));
await tester.pump();
expect(text.text, isEmpty);
expect(cleared, isTrue);
});
}
await tester.enterText(find.byKey(const ValueKey('field')), 'abc');
await tester.pump();
await tester.tap(find.byTooltip('Clear search'));
await tester.pump();
expect(text.text, isEmpty);
expect(cleared, isTrue);
});
}