App: dark-aware HTML views, run cards, changed/missing file notes, one card width, dense diff rows
show_html documents that declare dark support follow the app theme; others stay light. Tool description and skill docs say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../domain/artifact_html_theme.dart';
|
||||
import 'artifact_fullscreen.dart';
|
||||
import 'artifact_html_view_native.dart'
|
||||
if (dart.library.js_interop) 'artifact_html_view_web.dart'
|
||||
@@ -16,11 +17,19 @@ typedef ArtifactHtmlBuilder =
|
||||
/// live frame. The mobile web views pinch natively and offer none.
|
||||
const bool artifactHtmlZoomButtons = impl.inertHtmlZoomButtons;
|
||||
|
||||
/// Whether a recorded HTML document at [context] is shown in the dark scheme
|
||||
/// (when it supports one): the app's own theme, not the system's.
|
||||
bool artifactHtmlDark(BuildContext context) =>
|
||||
Theme.of(context).brightness == Brightness.dark;
|
||||
|
||||
/// 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.
|
||||
///
|
||||
/// A document that supports dark mode follows the app's theme
|
||||
/// ([artifactHtmlForScheme]); any other keeps a white page.
|
||||
///
|
||||
/// 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
|
||||
@@ -40,6 +49,7 @@ Widget defaultArtifactHtml(BuildContext context, String html) {
|
||||
html: html,
|
||||
interactive: fullscreen != null,
|
||||
zoom: fullscreen?.htmlZoom,
|
||||
dark: artifactHtmlDark(context),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user