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:
@@ -105,47 +105,42 @@ void main() {
|
||||
// The actions keep to the trailing edge.
|
||||
expect(pillOf(tester, find.byKey(const Key('action'))).right, 1200 - 12);
|
||||
});
|
||||
|
||||
testWidgets('$host: a shell tab publishing a field gets it in place of '
|
||||
'the title, without the Search action', (tester) async {
|
||||
setSize(tester, 560);
|
||||
await tester.pumpWidget(
|
||||
_shellApp(
|
||||
cupertino,
|
||||
AdaptiveShell(
|
||||
cupertino: cupertino,
|
||||
destination: AppDestination.search,
|
||||
onSearch: () {},
|
||||
destinationBodies: {
|
||||
AppDestination.search: (_) => ShellBar(
|
||||
titleWidget: field(cupertino),
|
||||
titleWidgetMaxWidth: 840,
|
||||
child: const SizedBox.expand(),
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
|
||||
final bar = find.byType(SegmentedBar);
|
||||
expect(
|
||||
find.descendant(of: bar, matching: find.byKey(fieldKey)),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.descendant(of: bar, matching: find.text('Search')),
|
||||
findsNothing,
|
||||
);
|
||||
expect(find.byKey(const ValueKey('shell.search')), findsNothing);
|
||||
// Measured at rest, after the pieces' entrance.
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
final pill = pillOf(tester, find.byKey(fieldKey));
|
||||
expect(pill.left, 12);
|
||||
expect(pill.right, 560 - 12);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Widget _shellApp(bool cupertino, Widget shell) =>
|
||||
cupertino ? CupertinoApp(home: shell) : MaterialApp(home: shell);
|
||||
testWidgets('a shell tab publishing a field gets it in place of the title, '
|
||||
'without the Search action', (tester) async {
|
||||
setSize(tester, 560);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: AdaptiveShell(
|
||||
destination: AppDestination.search,
|
||||
onSearch: () {},
|
||||
destinationBodies: {
|
||||
AppDestination.search: (_) => ShellBar(
|
||||
titleWidget: const TextField(key: fieldKey),
|
||||
titleWidgetMaxWidth: 840,
|
||||
child: const SizedBox.expand(),
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
|
||||
final bar = find.byType(SegmentedBar);
|
||||
expect(
|
||||
find.descendant(of: bar, matching: find.byKey(fieldKey)),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.descendant(of: bar, matching: find.text('Search')),
|
||||
findsNothing,
|
||||
);
|
||||
expect(find.byKey(const ValueKey('shell.search')), findsNothing);
|
||||
// Measured at rest, after the pieces' entrance.
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
final pill = pillOf(tester, find.byKey(fieldKey));
|
||||
expect(pill.left, 12);
|
||||
expect(pill.right, 560 - 12);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user