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:
2026-12-02 19:54:58 +00:00
parent d204ce3187
commit f02ff56dfe
27 changed files with 1086 additions and 61 deletions
@@ -4,6 +4,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:web/web.dart' as web;
import '../domain/artifact_html_theme.dart';
import 'artifact_html_links_web.dart';
/// The frame's document cannot be pinched: a pinch over it is a page zoom,
@@ -23,6 +24,10 @@ const bool inertHtmlZoomButtons = true;
/// document reflows and still scrolls inside it. In the app, Chrome returns
/// the frame's document to its top when a zoom step resizes it.
///
/// The document follows the app's theme ([dark]) when it supports dark mode
/// ([artifactHtmlForScheme]); the frame's own `color-scheme` matches, so the
/// browser paints the page's canvas in that scheme rather than always white.
///
/// While another route covers this one (a menu, a sheet) the frame stops
/// taking pointers: a platform view takes every click over its area, even
/// where Flutter draws that menu on top.
@@ -32,10 +37,14 @@ class InertHtmlView extends StatefulWidget {
required this.html,
this.interactive = false,
this.zoom,
this.dark = false,
});
final String html;
/// Whether the app is in its dark theme.
final bool dark;
/// The full-screen view's frame. Pointers already reach the frame directly
/// on the web, inline as in full screen.
final bool interactive;
@@ -91,16 +100,20 @@ class _InertHtmlViewState extends State<InertHtmlView> {
_covered = covered;
_style();
}
final scheme = artifactHtmlScheme(widget.html, dark: widget.dark);
return HtmlElementView.fromTagName(
key: ValueKey<int>(widget.html.hashCode),
key: ValueKey<(int, String)>((widget.html.hashCode, scheme)),
tagName: 'iframe',
onElementCreated: (element) {
final frame = element as web.HTMLIFrameElement;
frame.setAttribute('sandbox', artifactHtmlSandbox);
frame.srcdoc = artifactHtmlWithInertLinks(widget.html).toJS;
frame.srcdoc = artifactHtmlWithInertLinks(
artifactHtmlForScheme(widget.html, dark: widget.dark),
).toJS;
frame.style
..border = 'none'
..backgroundColor = 'white';
..colorScheme = scheme
..backgroundColor = scheme == 'dark' ? 'Canvas' : 'white';
_frame = frame;
_style();
},