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:
@@ -300,54 +300,48 @@ void main() {
|
||||
);
|
||||
expect(iconWidth(tester, 0), moreOrLessEquals(iconSize));
|
||||
});
|
||||
}
|
||||
|
||||
testWidgets('$host: switching the shell tabs never replays the main '
|
||||
"bar's entrance", (tester) async {
|
||||
animate(tester, on: true);
|
||||
var destination = AppDestination.runs;
|
||||
final shell = StatefulBuilder(
|
||||
builder: (context, setState) => AdaptiveShell(
|
||||
cupertino: cupertino,
|
||||
destination: destination,
|
||||
onDestinationSelected: (value) => setState(() => destination = value),
|
||||
),
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
cupertino ? CupertinoApp(home: shell) : MaterialApp(home: shell),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
for (final next in [
|
||||
AppDestination.pipelines,
|
||||
AppDestination.chat,
|
||||
AppDestination.runs,
|
||||
]) {
|
||||
await tester.tap(
|
||||
find.byKey(ValueKey('shell.destination.${next.name}')),
|
||||
);
|
||||
for (var frame = 0; frame < 12; frame += 1) {
|
||||
await tester.pump(const Duration(milliseconds: 25));
|
||||
for (final tab in shellTabDestinations) {
|
||||
final finder = find.byKey(
|
||||
ValueKey('shell.destination.${tab.name}'),
|
||||
);
|
||||
testWidgets('switching the shell tabs never replays the main '
|
||||
"bar's entrance", (tester) async {
|
||||
final size = FloatingDestinationBar.buttonSize(cupertino: false);
|
||||
animate(tester, on: true);
|
||||
var destination = AppDestination.runs;
|
||||
final shell = StatefulBuilder(
|
||||
builder: (context, setState) => AdaptiveShell(
|
||||
destination: destination,
|
||||
onDestinationSelected: (value) => setState(() => destination = value),
|
||||
),
|
||||
);
|
||||
await tester.pumpWidget(MaterialApp(home: shell));
|
||||
await tester.pumpAndSettle();
|
||||
for (final next in [
|
||||
AppDestination.pipelines,
|
||||
AppDestination.chat,
|
||||
AppDestination.runs,
|
||||
]) {
|
||||
await tester.tap(find.byKey(ValueKey('shell.destination.${next.name}')));
|
||||
for (var frame = 0; frame < 12; frame += 1) {
|
||||
await tester.pump(const Duration(milliseconds: 25));
|
||||
for (final tab in shellTabDestinations) {
|
||||
final finder = find.byKey(ValueKey('shell.destination.${tab.name}'));
|
||||
expect(
|
||||
opacityOf(tester, finder),
|
||||
1,
|
||||
reason: '${tab.name} faded switching to ${next.name}',
|
||||
);
|
||||
if (tab != next) {
|
||||
// The previous selection shrinks back to its size; nothing
|
||||
// pops again from 0.6.
|
||||
expect(
|
||||
opacityOf(tester, finder),
|
||||
1,
|
||||
reason: '${tab.name} faded switching to ${next.name}',
|
||||
widthOf(tester, finder),
|
||||
greaterThan(size * 0.9),
|
||||
reason: tab.name,
|
||||
);
|
||||
if (tab != next) {
|
||||
// The previous selection shrinks back to its size; nothing
|
||||
// pops again from 0.6.
|
||||
expect(
|
||||
widthOf(tester, finder),
|
||||
greaterThan(size * 0.9),
|
||||
reason: tab.name,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
});
|
||||
}
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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