Files
pipelines/app/lib/features/artifacts/ui/artifact_html_view.dart
T
alan 5132da62a9 Artifact viewer bar: right above the tab bar and clickable
The viewer's action/pager bar added the inherited bottom clearance twice
(its SafeArea already applies it), floating far above the tab bar. On the
web an HTML preview's iframe passed behind the bars and, as a platform view,
took every click there; it now stops at the bars. Also keep floating tabs in
semantics while they fade in, which broke the badge announcements (5 failing
tests on main since the entrance animation landed).
2026-11-01 16:55:14 +00:00

31 lines
1.2 KiB
Dart

import 'package:flutter/widgets.dart';
import 'artifact_html_view_native.dart'
if (dart.library.js_interop) 'artifact_html_view_web.dart'
as impl;
/// Builds the rendered HTML preview; tests inject a plain stand-in so no
/// platform view is created.
typedef ArtifactHtmlBuilder =
Widget Function(BuildContext context, String html);
/// Renders a recorded HTML document inertly: on the web in an iframe whose
/// empty `sandbox` blocks scripts, forms, popups and navigation; on Android and
/// iOS in a web view with JavaScript disabled and navigation refused. The
/// document never runs code with the app's origin or credentials.
///
/// The preview stops at the floating bars instead of passing behind them: on
/// the web the iframe is a platform view that takes every click over its
/// area, even where a bar is drawn on top, which left the viewer's actions
/// and pager unclickable.
Widget defaultArtifactHtml(BuildContext context, String html) {
final padding = MediaQuery.paddingOf(context);
return Padding(
padding: EdgeInsets.only(top: padding.top, bottom: padding.bottom),
child: SizedBox.expand(
key: const Key('artifact-html-preview'),
child: impl.InertHtmlView(html: html),
),
);
}