Keep pager controls clear of floating bars
This commit is contained in:
@@ -45,6 +45,7 @@ Future<void> _pumpViewer(
|
||||
ArtifactFetch? fetch,
|
||||
Widget Function(BuildContext, String)? markdownBuilder,
|
||||
ArtifactExternalOpen? openExternal,
|
||||
double bottomClearance = 0,
|
||||
}) async {
|
||||
final page = ArtifactViewerPage(
|
||||
groups: groups,
|
||||
@@ -55,10 +56,14 @@ Future<void> _pumpViewer(
|
||||
markdownBuilder ?? (context, value) => SelectableText(value),
|
||||
openExternal: openExternal ?? (_) async => true,
|
||||
);
|
||||
final child = MediaQuery(
|
||||
data: MediaQueryData(padding: EdgeInsets.only(bottom: bottomClearance)),
|
||||
child: page,
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
cupertino
|
||||
? CupertinoApp(home: page)
|
||||
: MaterialApp(home: Scaffold(body: page)),
|
||||
? CupertinoApp(home: child)
|
||||
: MaterialApp(home: Scaffold(body: child)),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
@@ -686,6 +691,46 @@ void main() {
|
||||
}
|
||||
});
|
||||
|
||||
for (final cupertino in [false, true]) {
|
||||
for (final size in [
|
||||
const Size(390, 844),
|
||||
const Size(880, 1000),
|
||||
const Size(1100, 800),
|
||||
]) {
|
||||
testWidgets(
|
||||
'${cupertino ? 'Cupertino' : 'Material'} pager clears stacked bar at $size',
|
||||
(tester) async {
|
||||
tester.view.physicalSize = size;
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final first = recordedArtifact(
|
||||
'a.png',
|
||||
url: '/artifacts/1/1/a.png',
|
||||
contentType: 'image/png',
|
||||
);
|
||||
final second = recordedArtifact(
|
||||
'b.png',
|
||||
url: '/artifacts/1/2/b.png',
|
||||
contentType: 'image/png',
|
||||
);
|
||||
final groups = [
|
||||
_group([first], visit: 1),
|
||||
_group([second], visit: 2),
|
||||
];
|
||||
await _pumpViewer(
|
||||
tester,
|
||||
groups: groups,
|
||||
selected: artifactVisitIdentity(groups[0], first),
|
||||
cupertino: cupertino,
|
||||
bottomClearance: 120,
|
||||
);
|
||||
final pager = tester.getRect(find.byKey(artifactNextKey));
|
||||
expect(pager.bottom, lessThanOrEqualTo(size.height - 120));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
testWidgets('Escape closes the viewer back to the gallery', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
|
||||
Reference in New Issue
Block a user