diff --git a/app/lib/features/artifacts/ui/artifact_viewer_body.dart b/app/lib/features/artifacts/ui/artifact_viewer_body.dart index 2195c74d..03e85d11 100644 --- a/app/lib/features/artifacts/ui/artifact_viewer_body.dart +++ b/app/lib/features/artifacts/ui/artifact_viewer_body.dart @@ -67,9 +67,7 @@ class ArtifactViewerBody extends StatelessWidget { @override Widget build(BuildContext context) { final resolved = plan.resolved; - // The page never scrolls: the preview fills the middle (it zooms or - // scrolls itself) and the controls float over its bottom edge. - final content = Column( + final preview = Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Expanded( @@ -85,6 +83,23 @@ class ArtifactViewerBody extends StatelessWidget { ), ], ); + // The page never scrolls: the preview fills the space between the top + // bar and the bottom controls (it zooms or scrolls itself), never + // passing behind either; the insets are spent here, not again inside. + final content = Builder( + builder: (context) { + final insets = MediaQuery.paddingOf(context); + return Padding( + padding: EdgeInsets.only(top: insets.top, bottom: insets.bottom), + child: MediaQuery.removePadding( + context: context, + removeTop: true, + removeBottom: true, + child: preview, + ), + ); + }, + ); final hasPrevious = pagedIndex(index, -1, count) != index; final hasNext = pagedIndex(index, 1, count) != index; final swipe = GestureDetector( diff --git a/app/test/features/artifacts/ui/artifact_viewer_page_test.dart b/app/test/features/artifacts/ui/artifact_viewer_page_test.dart index d9c59505..4b1d595e 100644 --- a/app/test/features/artifacts/ui/artifact_viewer_page_test.dart +++ b/app/test/features/artifacts/ui/artifact_viewer_page_test.dart @@ -13,11 +13,12 @@ import 'package:pipelines_app/features/artifacts/domain/artifact_record.dart'; import 'package:pipelines_app/features/artifacts/ui/artifact_external_open.dart'; import 'package:pipelines_app/features/artifacts/ui/artifact_gallery_page.dart'; import 'package:pipelines_app/features/artifacts/ui/artifact_viewer_content.dart' - show artifactPreviewRetryKey; + show ArtifactPreviewBody, artifactPreviewRetryKey; import 'package:pipelines_app/features/artifacts/ui/artifact_viewer_fetch.dart'; import 'package:pipelines_app/features/artifacts/ui/artifact_viewer_page.dart'; import 'package:pipelines_app/features/artifacts/ui/artifact_visit_list.dart'; import 'package:pipelines_app/ui/adaptive/glass_pill.dart'; +import 'package:pipelines_app/ui/adaptive/segmented_bar.dart'; import 'package:pipelines_app/features/chat/ui/transcript/chat_markdown_view.dart'; import '../domain/artifact_fixtures.dart'; @@ -729,6 +730,16 @@ void main() { // Right above the stacked bar, not lifted by its clearance twice // (the bar is one 56 px pill above the inset plus its margin). expect(pager.bottom, greaterThanOrEqualTo(size.height - 120 - 56)); + // The preview sits between the bars, never behind either. + final preview = tester.getRect( + find.byType(ArtifactPreviewBody).first, + ); + final actions = tester.getRect( + find.byKey(const Key('artifact-viewer-actions')), + ); + final topBar = tester.getRect(find.byType(SegmentedBar).first); + expect(preview.bottom, lessThanOrEqualTo(actions.top)); + expect(preview.top, greaterThanOrEqualTo(topBar.bottom - 1)); }, ); }