21 lines
832 B
Dart
21 lines
832 B
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.
|
|
Widget defaultArtifactHtml(BuildContext context, String html) =>
|
|
SizedBox.expand(
|
|
key: const Key('artifact-html-preview'),
|
|
child: impl.InertHtmlView(html: html),
|
|
);
|