merge(app): land artifacts-layout
This commit is contained in:
@@ -83,7 +83,8 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
||||
// The visit pane sees the same document-enriched group the gallery shows for
|
||||
// that visit, not only its recorded files.
|
||||
for (final enriched in galleryGroups(widget.steps)) {
|
||||
if (enriched.stageKey == group.stageKey && enriched.visit == group.visit) {
|
||||
if (enriched.stageKey == group.stageKey &&
|
||||
enriched.visit == group.visit) {
|
||||
// The visit pane's own Session section opens session.html, so the
|
||||
// per-visit Artifacts drill-down keeps only stage output and the other
|
||||
// turn documents; the run-wide gallery still shows every document.
|
||||
@@ -193,21 +194,21 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
||||
title: Text(artifactDisplayName(artifact)),
|
||||
content: content,
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
onPressed: () => Navigator.of(dialogContext).pop(),
|
||||
child: const Text('Close'),
|
||||
),
|
||||
if (resolved != null)
|
||||
CupertinoDialogAction(
|
||||
onPressed: () => _copyLink(resolved, dialogContext),
|
||||
child: const Text('Copy link'),
|
||||
),
|
||||
if (resolved != null)
|
||||
CupertinoDialogAction(
|
||||
isDefaultAction: true,
|
||||
onPressed: () => _open(resolved, dialogContext),
|
||||
child: const Text('Open'),
|
||||
),
|
||||
if (resolved != null)
|
||||
CupertinoDialogAction(
|
||||
onPressed: () => _copyLink(resolved, dialogContext),
|
||||
child: const Text('Copy link'),
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
onPressed: () => Navigator.of(dialogContext).pop(),
|
||||
child: const Text('Close'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -218,15 +219,15 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
||||
title: Text(artifactDisplayName(artifact)),
|
||||
content: SingleChildScrollView(child: content),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(dialogContext).pop(),
|
||||
child: const Text('Close'),
|
||||
),
|
||||
if (resolved != null)
|
||||
TextButton(
|
||||
onPressed: () => _copyLink(resolved, dialogContext),
|
||||
child: const Text('Copy link'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(dialogContext).pop(),
|
||||
child: const Text('Close'),
|
||||
),
|
||||
if (resolved != null)
|
||||
TextButton(
|
||||
onPressed: () => _open(resolved, dialogContext),
|
||||
@@ -267,14 +268,25 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
||||
setState(() => _status = message);
|
||||
}
|
||||
|
||||
/// The step a focused page shows, or null when the page covers the whole run.
|
||||
///
|
||||
/// [focusIndex] comes from the opening visit pane, so it is validated once
|
||||
/// here rather than in each of the summary, notes and group builders.
|
||||
JsonMap? get _focusedStep {
|
||||
final focusIndex = widget.focusIndex;
|
||||
if (focusIndex == null ||
|
||||
focusIndex < 0 ||
|
||||
focusIndex >= widget.steps.length) {
|
||||
return null;
|
||||
}
|
||||
return widget.steps[focusIndex];
|
||||
}
|
||||
|
||||
/// The page's one summary line: a focused visit uses its own capture summary,
|
||||
/// a run-level page uses the run header, and an empty reply says so.
|
||||
String _summary(List<ArtifactGroup> groups) {
|
||||
final focusIndex = widget.focusIndex;
|
||||
if (focusIndex != null &&
|
||||
focusIndex >= 0 &&
|
||||
focusIndex < widget.steps.length) {
|
||||
final focused = widget.steps[focusIndex];
|
||||
final focused = _focusedStep;
|
||||
if (focused != null) {
|
||||
final count = groups.fold<int>(
|
||||
0,
|
||||
(total, group) => total + group.artifacts.length,
|
||||
@@ -285,32 +297,87 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
||||
return artifactsHeader(widget.steps, executing: widget.executing);
|
||||
}
|
||||
|
||||
/// The partial-capture notes shown under the page's summary.
|
||||
///
|
||||
/// A focused visit states its own capture facts, matching the web client's
|
||||
/// per-visit artifact section. The run-wide page keeps each visit's recorded
|
||||
/// wording and names the visit it belongs to, because the same count means
|
||||
/// different files in a different visit. Complete captures add nothing.
|
||||
List<String> _captureNotes() {
|
||||
final focused = _focusedStep;
|
||||
if (focused != null) return artifactCaptureNotes(focused);
|
||||
return <String>[
|
||||
for (final group in _groups)
|
||||
for (final note in artifactCaptureNotes(
|
||||
_stepsByGroup[artifactGroupKey(group.stageKey, group.visit)] ??
|
||||
const <String, dynamic>{},
|
||||
))
|
||||
'${artifactGroupLabel(group)} · $note',
|
||||
];
|
||||
}
|
||||
|
||||
/// The compact page header: the recorded count on one line, then the visit's
|
||||
/// capture notes in the host's secondary label style, then any transient
|
||||
/// status.
|
||||
///
|
||||
/// The header is handed to [ArtifactVisitList] as its leading child, so a run
|
||||
/// with many partial visits — or a focused visit at large text — scrolls with
|
||||
/// the artifacts instead of taking height from them. It is content-driven:
|
||||
/// one line per recorded fact, never clamped or shortened.
|
||||
Widget _header(BuildContext context, String summary) {
|
||||
final notes = _captureNotes();
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final textStyle = cupertino
|
||||
? CupertinoTheme.of(context).textTheme.textStyle
|
||||
: Theme.of(context).textTheme.bodyMedium ?? const TextStyle();
|
||||
final headingStyle = cupertino
|
||||
? textStyle.copyWith(fontWeight: FontWeight.w600)
|
||||
: Theme.of(context).textTheme.titleSmall;
|
||||
final noteStyle = textStyle.copyWith(
|
||||
color: cupertino
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
);
|
||||
return Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Semantics(
|
||||
container: true,
|
||||
header: true,
|
||||
child: Text(summary, style: headingStyle),
|
||||
),
|
||||
for (final note in notes)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 2),
|
||||
child: Text(note, style: noteStyle),
|
||||
),
|
||||
if (_status != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: Semantics(liveRegion: true, child: Text(_status!)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final groups = _groups;
|
||||
final summary = _summary(groups);
|
||||
final body = Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 4),
|
||||
child: Text(summary),
|
||||
),
|
||||
if (_status != null)
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 0, 16, 4),
|
||||
child: Semantics(liveRegion: true, child: Text(_status!)),
|
||||
),
|
||||
if (groups.isNotEmpty)
|
||||
Expanded(
|
||||
child: ArtifactVisitList(
|
||||
groups: groups,
|
||||
selectedIdentity: _selectedIdentity,
|
||||
onSelected: _select,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
final header = _header(context, _summary(groups));
|
||||
// Header, status and rows share one scroll view: the page never splits a
|
||||
// fixed header from a shrinking list, so a long header always stays usable.
|
||||
final body = groups.isEmpty
|
||||
? ListView(children: [header])
|
||||
: ArtifactVisitList(
|
||||
header: header,
|
||||
groups: groups,
|
||||
selectedIdentity: _selectedIdentity,
|
||||
onSelected: _select,
|
||||
);
|
||||
if (usesCupertinoHost(context)) {
|
||||
return CupertinoPageScaffold(
|
||||
// Sections paint the grouped background; the page must match it or a
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../graph/domain/stage_visits.dart';
|
||||
import '../domain/artifact_groups.dart';
|
||||
import '../domain/artifact_record.dart';
|
||||
@@ -27,6 +29,12 @@ Map<String, JsonMap> recordedStepsByGroup(List<JsonMap> steps) {
|
||||
|
||||
/// The recorded facts of one selected artifact: name, MIME/size, its visit's
|
||||
/// capture summary and notes, and the url state. Nothing is inferred.
|
||||
///
|
||||
/// The same block heads the selection sheet and the viewer, so both surfaces
|
||||
/// read the same way: the artifact's name is the surface title, the recorded
|
||||
/// type/size and visit are muted metadata, and the visit's capture summary and
|
||||
/// notes sit below them. Typography is the host theme's own body and secondary
|
||||
/// label styles; no size, colour or spacing scale is declared here.
|
||||
class ArtifactSelectionFacts extends StatelessWidget {
|
||||
const ArtifactSelectionFacts({
|
||||
super.key,
|
||||
@@ -45,25 +53,43 @@ class ArtifactSelectionFacts extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final recordedStep = step;
|
||||
final url = resolved;
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final primaryStyle = cupertino
|
||||
? CupertinoTheme.of(context).textTheme.textStyle
|
||||
: Theme.of(context).textTheme.bodyMedium ?? const TextStyle();
|
||||
final secondaryStyle = primaryStyle.copyWith(
|
||||
color: cupertino
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(artifactFactsLabel(artifact)),
|
||||
const SizedBox(height: 8),
|
||||
Text(artifactGroupLabel(group)),
|
||||
Text(artifactFactsLabel(artifact), style: secondaryStyle),
|
||||
const SizedBox(height: 6),
|
||||
Text(artifactGroupLabel(group), style: secondaryStyle),
|
||||
if (recordedStep != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(artifactsSummary(recordedStep, count: group.recordedCount)),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
artifactsSummary(recordedStep, count: group.recordedCount),
|
||||
style: primaryStyle,
|
||||
),
|
||||
for (final note in artifactCaptureNotes(recordedStep))
|
||||
Padding(padding: const EdgeInsets.only(top: 4), child: Text(note)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 2),
|
||||
child: Text(note, style: secondaryStyle),
|
||||
),
|
||||
],
|
||||
if (!artifact.hasUrl) ...[
|
||||
const SizedBox(height: 8),
|
||||
const Text('No artifact URL recorded.'),
|
||||
const SizedBox(height: 12),
|
||||
Text('No artifact URL recorded.', style: secondaryStyle),
|
||||
] else if (url == null) ...[
|
||||
const SizedBox(height: 8),
|
||||
const Text('The recorded artifact URL cannot be opened safely.'),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'The recorded artifact URL cannot be opened safely.',
|
||||
style: secondaryStyle,
|
||||
),
|
||||
],
|
||||
],
|
||||
);
|
||||
|
||||
@@ -23,16 +23,27 @@ export 'artifact_row_labels.dart'
|
||||
/// content type and size; a turn document the visit did not record stays a
|
||||
/// non-actionable row with the exact absence wording. Rendering uses the host's
|
||||
/// own controls: Material list tiles under [MaterialApp] and grouped Cupertino
|
||||
/// list sections under [CupertinoApp]. It never resolves a url, opens a preview,
|
||||
/// downloads, shares or filters.
|
||||
/// list sections under [CupertinoApp]. An optional [header] leads the same
|
||||
/// scroll view. It never resolves a url, opens a preview, downloads, shares or
|
||||
/// filters.
|
||||
class ArtifactVisitList extends StatelessWidget {
|
||||
const ArtifactVisitList({
|
||||
super.key,
|
||||
required this.groups,
|
||||
this.header,
|
||||
this.selectedIdentity,
|
||||
this.onSelected,
|
||||
});
|
||||
|
||||
/// An optional page header rendered above the first section, inside the same
|
||||
/// scroll view.
|
||||
///
|
||||
/// A header sized by recorded facts (a summary and one line per capture note)
|
||||
/// must not take height from the list: it scrolls away with the rows instead
|
||||
/// of shrinking the viewport, which keeps every artifact reachable at a small
|
||||
/// surface or a large text scale.
|
||||
final Widget? header;
|
||||
|
||||
final List<ArtifactGroup> groups;
|
||||
|
||||
/// [artifactVisitIdentity] of the selected artifact, or null for none.
|
||||
@@ -42,12 +53,14 @@ class ArtifactVisitList extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final header = this.header;
|
||||
if (groups.isEmpty) {
|
||||
return const _NoArtifacts();
|
||||
return _NoArtifacts(header: header);
|
||||
}
|
||||
if (usesCupertinoHost(context)) {
|
||||
return ListView(
|
||||
children: [
|
||||
?header,
|
||||
for (final group in groups) ...[
|
||||
CupertinoListSection.insetGrouped(
|
||||
// `container` keeps the heading a separate semantics node. Without
|
||||
@@ -74,19 +87,29 @@ class ArtifactVisitList extends StatelessWidget {
|
||||
],
|
||||
);
|
||||
}
|
||||
final theme = Theme.of(context);
|
||||
final headingStyle = theme.textTheme.titleSmall?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
);
|
||||
return ListView(
|
||||
children: [
|
||||
?header,
|
||||
for (final group in groups) ...<Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 16, 16, 4),
|
||||
child: Semantics(
|
||||
container: true,
|
||||
header: true,
|
||||
child: Text(artifactGroupLabel(group)),
|
||||
child: Text(artifactGroupLabel(group), style: headingStyle),
|
||||
),
|
||||
),
|
||||
for (var index = 0; index < group.artifacts.length; index += 1)
|
||||
for (var index = 0; index < group.artifacts.length; index += 1) ...[
|
||||
// A hairline between rows, inset to the row's own text, is the
|
||||
// Material list idiom the web list also uses; it never follows the
|
||||
// last row, so a section ends on its content, not on a rule.
|
||||
if (index > 0) const Divider(height: 1, indent: 16, endIndent: 16),
|
||||
_row(group, group.artifacts[index], index),
|
||||
],
|
||||
if (group.documents.isNotEmpty)
|
||||
ArtifactDocumentSection(
|
||||
group: group,
|
||||
@@ -112,13 +135,16 @@ class ArtifactVisitList extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _NoArtifacts extends StatelessWidget {
|
||||
const _NoArtifacts();
|
||||
const _NoArtifacts({this.header});
|
||||
|
||||
final Widget? header;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView(
|
||||
children: const [
|
||||
Padding(
|
||||
children: [
|
||||
?header,
|
||||
const Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Text('No stage artifacts recorded.'),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user