Artifact viewer: keep the preview between the top bar and the controls

Every preview (image, text, markdown, HTML, video) now fills the space between
the viewer's top bar and its bottom controls instead of passing behind them;
the insets are applied once here and removed for the content inside.
This commit is contained in:
2026-11-01 21:22:36 +00:00
parent b57b494959
commit a322e367da
2 changed files with 30 additions and 4 deletions
@@ -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(
@@ -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));
},
);
}