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:
@@ -4,6 +4,7 @@ import 'package:flutter/widgets.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
import '../domain/artifact_html_links.dart';
|
||||
import '../domain/artifact_html_theme.dart';
|
||||
import 'artifact_external_open.dart';
|
||||
|
||||
/// The mobile web views pinch-zoom natively (Android's built-in zoom, which
|
||||
@@ -29,10 +30,15 @@ class InertHtmlView extends StatefulWidget {
|
||||
this.interactive = false,
|
||||
this.zoom,
|
||||
this.openExternal = openArtifactExternally,
|
||||
this.dark = false,
|
||||
});
|
||||
|
||||
final String html;
|
||||
|
||||
/// Whether the app is in its dark theme: a document that supports dark mode
|
||||
/// is loaded in it ([artifactHtmlForScheme]).
|
||||
final bool dark;
|
||||
|
||||
/// Opens a link's http(s)/mailto address outside the artifact.
|
||||
final ArtifactExternalOpen openExternal;
|
||||
final bool interactive;
|
||||
@@ -66,7 +72,9 @@ class _InertHtmlViewState extends State<InertHtmlView> {
|
||||
onNavigationRequest: _decide,
|
||||
),
|
||||
)
|
||||
..loadHtmlString(widget.html);
|
||||
..loadHtmlString(_document);
|
||||
|
||||
String get _document => artifactHtmlForScheme(widget.html, dark: widget.dark);
|
||||
|
||||
/// Links: a place in the document scrolls there; an http(s)/mailto address
|
||||
/// opens in the system's handler, never inside this view; anything else
|
||||
@@ -91,9 +99,9 @@ class _InertHtmlViewState extends State<InertHtmlView> {
|
||||
@override
|
||||
void didUpdateWidget(covariant InertHtmlView oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (oldWidget.html != widget.html) {
|
||||
if (oldWidget.html != widget.html || oldWidget.dark != widget.dark) {
|
||||
_loaded = false;
|
||||
_controller.loadHtmlString(widget.html);
|
||||
_controller.loadHtmlString(_document);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user