Complete Material-only APIs and fixtures

Remove obsolete control-family flags and icon metadata across all callers, dead alternate themes and host helpers, obsolete test setup, and the unused icon-font dependency. Preserve native Material Back transitions. Make navigation fixtures independent of update plugins and answer auxiliary shell snapshots so the complete application suite can run deterministically.
This commit is contained in:
2026-11-11 21:55:39 +00:00
parent 63b2fd12cd
commit 9551eceaed
222 changed files with 540 additions and 1351 deletions
@@ -81,16 +81,13 @@ void main() {
expect(requested, 1);
});
testWidgets('a stale cupertino flag still draws the Material row', (
tester,
) async {
testWidgets('the permission prompt draws the Material row', (tester) async {
await tester.pumpWidget(
attentionApp(
Scaffold(
body: SingleChildScrollView(
child: NotificationPermissionTile(
state: NotificationPermissionState.notRequested,
cupertino: true,
onRequest: _noop,
),
),
@@ -55,7 +55,6 @@ Future<void> _pumpShell(
child: child!,
),
home: AdaptiveShell(
cupertino: false,
destination: AppDestination.chat,
destinationBodies: {
AppDestination.chat: (_) => ChatScreen(gateway: gateway),
@@ -64,7 +64,6 @@ Future<_Gateway> _pumpShell(
MaterialApp(
theme: ThemeData(platform: platform, brightness: brightness),
home: AdaptiveShell(
cupertino: false,
destination: AppDestination.chat,
destinationBodies: {
AppDestination.chat: (_) => ChatScreen(gateway: gateway),
@@ -182,7 +182,6 @@ void main() {
test('the route reads its timing from Motion', () {
final route = ContainerTransformPageRoute<void>(
link: ContainerTransformLink(() => null),
cupertino: false,
builder: (_) => const SizedBox(),
);
expect(route.transitionDuration, Motion.containerTransform);
@@ -102,7 +102,7 @@ Future<void> _pump(
}
/// The mode the drawn control names, or null when the bar has none. A
/// Cupertino phone bar draws only the shield, so read the control itself.
/// A narrow phone bar draws only the shield, so read the control itself.
String? _shown(WidgetTester tester) {
if (_modeControl.evaluate().isEmpty) return null;
final control = find.byType(ChatModeControl);
@@ -112,7 +112,7 @@ String? _shown(WidgetTester tester) {
void main() {
for (final platform in [TargetPlatform.android, TargetPlatform.iOS]) {
final style = platform == TargetPlatform.iOS ? 'Cupertino' : 'Material';
final style = 'Material on ${platform.name}';
testWidgets(
'$style: an existing chat opened from the list shows its mode',
@@ -64,7 +64,6 @@ Future<_Gateway> _setup(WidgetTester tester, {bool inShell = false}) async {
inShell
? MaterialApp(
home: AdaptiveShell(
cupertino: false,
destination: AppDestination.chat,
destinationBodies: {
AppDestination.chat: (_) => ChatScreen(gateway: gateway),
@@ -58,7 +58,6 @@ Future<void> _mount(WidgetTester tester, Size size) async {
MaterialApp(
theme: ThemeData(platform: TargetPlatform.android),
home: AdaptiveShell(
cupertino: false,
destination: AppDestination.chat,
destinationBodies: {
AppDestination.chat: (_) => ChatScreen(gateway: gateway),
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -17,7 +16,6 @@ void main() {
await pumpIosMaterialChat(tester, FakeChatGateway());
expect(find.byType(Scaffold), findsWidgets);
expect(find.byType(CupertinoPageScaffold), findsNothing);
const message = 'No chat sessions on this server yet.';
expect(find.text(message), findsOneWidget);
@@ -42,7 +40,15 @@ void main() {
expect(find.text(message), findsOneWidget);
expectNormalTextStyle(tester, message);
expect(find.text('No chat sessions on this server yet.'), findsNothing);
expect(find.widgetWithText(CupertinoButton, 'Retry'), findsNothing);
expect(
find.ancestor(
of: find.text('Retry'),
matching: find.byWidgetPredicate(
(widget) => widget is ButtonStyleButton,
),
),
findsOneWidget,
);
expect(find.text('Retry'), findsOneWidget);
});
}
@@ -56,8 +56,7 @@ Future<void> pumpMaterialChat(
await tester.pumpAndSettle();
}
/// The screen's iOS/macOS path: Cupertino controls under the app's ordinary
/// `MaterialApp` root, with no Material or CupertinoTheme ancestor.
/// The screen's iOS/macOS path uses the same ordinary Material app root.
Future<void> pumpIosMaterialChat(
WidgetTester tester,
FakeChatGateway gateway, {
@@ -69,7 +69,7 @@ void main() {
await tester.pumpAndSettle();
final context = tester.element(find.byType(ChatMessageView));
final fontSize = chatMessageTextStyle(context, false)!.fontSize!;
final fontSize = chatMessageTextStyle(context)!.fontSize!;
final line = fontSize * scale;
Rect rect(String text) =>
tester.getRect(find.textContaining(text, findRichText: true).first);
@@ -62,7 +62,6 @@ void main() {
find.byKey(const Key('pipeline-version-3')),
);
expect(row.selected, isTrue);
expect(row.cupertino, isFalse);
expect(tester.takeException(), isNull);
});
}
@@ -39,13 +39,14 @@ void main() {
),
);
Widget scaled(BuildContext context, Widget? child) => MediaQuery(
data: MediaQuery.of(
context,
).copyWith(textScaler: TextScaler.linear(2)),
data: MediaQuery.of(context).copyWith(textScaler: TextScaler.linear(2)),
child: child!,
);
await tester.pumpWidget(
MaterialApp(builder: scaled, home: Scaffold(body: body)),
MaterialApp(
builder: scaled,
home: Scaffold(body: body),
),
);
await tester.pumpAndSettle();
// One floating bar of separate round tab buttons.
@@ -55,10 +56,7 @@ void main() {
expect(pill.right, width - 16);
expect(
pill.width,
FloatingDestinationBar.rowWidth(
cupertino: false,
tabs: PipelineDetailTab.values.length,
),
FloatingDestinationBar.rowWidth(tabs: PipelineDetailTab.values.length),
);
for (final tab in PipelineDetailTab.values) {
final rect = tester.getRect(
@@ -100,10 +100,7 @@ void main() {
// Sized to its tabs at the right, floating above the bottom.
expect(
pill.width,
FloatingDestinationBar.rowWidth(
cupertino: false,
tabs: renderedRunDetailTabs.length,
),
FloatingDestinationBar.rowWidth(tabs: renderedRunDetailTabs.length),
);
expect(pill.right, 390 - 16);
expect(pill.bottom, 844 - 16);
@@ -114,7 +114,6 @@ void main() {
builder: (context) => runDetailSummaryTab(
context: context,
run: _running,
cupertino: false,
copying: false,
copyStatus: null,
onCopy: () {},
@@ -152,11 +151,7 @@ void main() {
await tester.pumpWidget(
_host(
time,
RunTimelineList(
visits: detailTimeline(steps),
cupertino: false,
onSelected: (_) {},
),
RunTimelineList(visits: detailTimeline(steps), onSelected: (_) {}),
),
);
expect(find.text('2m 0s'), findsOneWidget);
@@ -29,7 +29,6 @@ void main() {
testWidgets('timeline rows lead with their real status', (tester) async {
final list = RunTimelineList(
visits: detailTimeline(_steps),
cupertino: false,
onSelected: (_) {},
);
await tester.pumpWidget(MaterialApp(home: Scaffold(body: list)));
@@ -71,10 +70,7 @@ void main() {
'outcome': outcome,
},
];
final list = RunTimelineList(
visits: detailTimeline(steps),
cupertino: false,
);
final list = RunTimelineList(visits: detailTimeline(steps));
await tester.pumpWidget(MaterialApp(home: Scaffold(body: list)));
Color chip(String text, [int at = 0]) =>
tester.widget<Text>(find.text(text).at(at)).style!.color!;
@@ -19,14 +19,10 @@ void main() {
(type, fields) async => schedulesReply(longScheduleList(30)),
);
final screen = SchedulesScreen(gateway: gateway, onOpen: (_) {});
final bar = const SegmentedBar(cupertino: false, title: 'Schedules');
final bar = const SegmentedBar(title: 'Schedules');
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
extendBodyBehindAppBar: true,
appBar: bar,
body: screen,
),
home: Scaffold(extendBodyBehindAppBar: true, appBar: bar, body: screen),
),
);
await tester.pumpAndSettle();
@@ -189,12 +189,7 @@ void main() {
Future<void> openMenu(JsonMap run) async {
await pumpAction(
tester,
RunMoreMenu(
run: run,
gateway: gateway,
onRunChanged: (_) {},
cupertino: false,
),
RunMoreMenu(run: run, gateway: gateway, onRunChanged: (_) {}),
);
// A run with nothing to offer shows no menu at all.
if (find.byKey(runMoreMenuKey).evaluate().isEmpty) return;
@@ -31,7 +31,7 @@ void main() {
_size(tester, 390);
final gateway = ImmediateGateway((_, _) => response([pipeline]));
await tester.pumpWidget(
_app(SearchScreen(gateway: gateway, onOpen: (_) {}, cupertino: false)),
_app(SearchScreen(gateway: gateway, onOpen: (_) {})),
);
for (final key in [searchFieldKey, searchKindKey, searchHelpKey]) {
@@ -63,7 +63,7 @@ void main() {
return reply;
});
await tester.pumpWidget(
_app(SearchScreen(gateway: gateway, onOpen: (_) {}, cupertino: false)),
_app(SearchScreen(gateway: gateway, onOpen: (_) {})),
);
await _search(tester, 'release');
@@ -81,13 +81,13 @@ void main() {
_size(tester, 390);
final gateway = ImmediateGateway((_, _) => response([field]));
await tester.pumpWidget(
_app(SearchScreen(gateway: gateway, onOpen: (_) {}, cupertino: false)),
_app(SearchScreen(gateway: gateway, onOpen: (_) {})),
);
await _search(tester, 'release');
final row = find.byKey(const ValueKey('search.result.run:11:4:output'));
expect(row, findsOneWidget);
expect(tester.widget<AppListRow>(row).cupertino, isFalse);
expect(tester.widget<AppListRow>(row).title, isNotNull);
// The kind leads the one muted line, before the snippet.
expect(
find.descendant(of: row, matching: find.textContaining('Field · ')),
@@ -106,7 +106,7 @@ void main() {
_size(tester, 1200);
final gateway = ImmediateGateway((_, _) => response([pipeline]));
await tester.pumpWidget(
_app(SearchScreen(gateway: gateway, onOpen: (_) {}, cupertino: false)),
_app(SearchScreen(gateway: gateway, onOpen: (_) {})),
);
await _search(tester, 'release');
@@ -130,7 +130,7 @@ void main() {
_size(tester, width);
final gateway = ImmediateGateway((_, _) => response([pipeline]));
await tester.pumpWidget(
_app(SearchScreen(gateway: gateway, onOpen: (_) {}, cupertino: false)),
_app(SearchScreen(gateway: gateway, onOpen: (_) {})),
);
await _search(tester, 'release');
@@ -25,13 +25,7 @@ void main() {
final gateway = ImmediateGateway(replies);
JsonMap? opened;
await tester.pumpWidget(
host(
SearchScreen(
gateway: gateway,
onOpen: (value) => opened = value,
cupertino: false,
),
),
host(SearchScreen(gateway: gateway, onOpen: (value) => opened = value)),
);
await search(tester, 'release');
@@ -77,7 +71,7 @@ void main() {
final gateway = ImmediateGateway(replies);
await tester.pumpWidget(
MaterialApp(
home: SearchScreen(gateway: gateway, onOpen: (_) {}, cupertino: false),
home: SearchScreen(gateway: gateway, onOpen: (_) {}),
),
);
await search(tester, 't:chat release');
@@ -100,7 +94,7 @@ void main() {
});
await tester.pumpWidget(
MaterialApp(
home: SearchScreen(gateway: gateway, onOpen: (_) {}, cupertino: false),
home: SearchScreen(gateway: gateway, onOpen: (_) {}),
),
);
await search(tester, 'release');
@@ -110,11 +110,7 @@ void main() {
await tester.pumpWidget(
MaterialApp(
home: largeText(
SearchScreen(
gateway: gateway,
onOpen: (value) => opened = value,
cupertino: false,
),
SearchScreen(gateway: gateway, onOpen: (value) => opened = value),
),
),
);
@@ -155,11 +151,7 @@ void main() {
JsonMap? opened;
await tester.pumpWidget(
MaterialApp(
home: SearchScreen(
gateway: gateway,
onOpen: (value) => opened = value,
cupertino: false,
),
home: SearchScreen(gateway: gateway, onOpen: (value) => opened = value),
),
);
await search(tester, 'widget');
@@ -176,7 +168,7 @@ void main() {
final gateway = FailingThenSucceedingGateway(response([pipeline]));
await tester.pumpWidget(
MaterialApp(
home: SearchScreen(gateway: gateway, onOpen: (_) {}, cupertino: false),
home: SearchScreen(gateway: gateway, onOpen: (_) {}),
),
);
await search(tester, 'release');
@@ -63,15 +63,12 @@ class TemplateCreateHost extends StatelessWidget {
super.key,
required this.gateway,
required this.onCreated,
this.cupertino = false,
this.template = templateCreateFixture,
});
final FakeTemplateCreateGateway gateway;
final ValueChanged<JsonMap> onCreated;
/// Retained for callers that still pass it; the host is always Material.
final bool cupertino;
final TemplateEntry template;
void _open(BuildContext context) {
@@ -79,7 +76,6 @@ class TemplateCreateHost extends StatelessWidget {
context: context,
template: template,
repository: TemplateRepository(gateway),
cupertino: cupertino,
onCreated: onCreated,
);
}
@@ -97,11 +93,7 @@ class TemplateCreateHost extends StatelessWidget {
}
}
Widget templateCreateApp(
Widget child, {
bool cupertino = false,
double textScale = 1,
}) {
Widget templateCreateApp(Widget child, {double textScale = 1}) {
Widget media(BuildContext context, Widget? app) => MediaQuery(
data: MediaQuery.of(
context,
@@ -82,7 +82,6 @@ Future<JsonMap> acceptedCreate(String type, JsonMap fields) async {
Future<void> pumpGallery(
WidgetTester tester,
GalleryGateway gateway, {
bool cupertino = false,
bool embedded = false,
ValueChanged<JsonMap>? onCreated,
double textScale = 1,
@@ -20,7 +20,6 @@ void main() {
onPressed: () => showLaunchUpdateDialog(
context,
web: false,
cupertino: false,
nativePlatform: platform,
sourceName: 'Home Linux',
),
@@ -43,8 +42,7 @@ void main() {
MaterialApp(
home: Builder(
builder: (context) => TextButton(
onPressed: () =>
showLaunchUpdateFailure(context, 'boom', cupertino: false),
onPressed: () => showLaunchUpdateFailure(context, 'boom'),
child: const Text('Fail'),
),
),
@@ -84,7 +82,6 @@ void main() {
onProgress?.call(0.5);
await finished.future;
},
cupertino: false,
);
await tester.pumpAndSettle();
expect(find.byType(AlertDialog), findsOneWidget);