Merge branch 'worktree-agent-a82ec5e9fdf8ca159' into integrate/gaps-e
# Conflicts: # app/test/features/search/search_bar_layout_test.dart
This commit is contained in:
@@ -36,11 +36,12 @@ Widget buildCupertinoRunDetail({
|
||||
configuredEndpoint: configuredEndpoint,
|
||||
initialStageKey: initialStageKey,
|
||||
initialVisit: initialVisit,
|
||||
// A glass strip under the top bar: as wide as its content.
|
||||
header: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 4, 16, 0),
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(12, 4, 12, 4),
|
||||
child: Wrap(
|
||||
spacing: 12,
|
||||
runSpacing: 4,
|
||||
@@ -68,7 +69,7 @@ class _CupertinoNotice extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 8, 16, 0),
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(12, 0, 12, 8),
|
||||
child: Semantics(liveRegion: true, child: Text(text)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -37,11 +37,12 @@ Widget buildMaterialRunDetail({
|
||||
configuredEndpoint: configuredEndpoint,
|
||||
initialStageKey: initialStageKey,
|
||||
initialVisit: initialVisit,
|
||||
// A glass strip under the top bar: as wide as its content.
|
||||
header: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 4, 16, 0),
|
||||
padding: const EdgeInsets.fromLTRB(12, 4, 12, 4),
|
||||
child: Wrap(
|
||||
spacing: 12,
|
||||
runSpacing: 4,
|
||||
@@ -68,7 +69,7 @@ class _Notice extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
padding: const EdgeInsets.fromLTRB(12, 0, 12, 8),
|
||||
child: Semantics(liveRegion: true, child: Text(text)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../../ui/adaptive/segmented_bar.dart';
|
||||
import '../../../ui/adaptive/top_glass_strip.dart';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -29,8 +30,9 @@ import 'run_search_selection.dart';
|
||||
/// reserve keeps its bounded canvas positive at 320px with 2x text.
|
||||
const double kRunDetailMinContentHeight = 240;
|
||||
|
||||
/// The run detail's tabbed body: the host-built header above the bounded
|
||||
/// selected tab, with the floating tab bar over the bottom of the tab.
|
||||
/// The run detail's tabbed body: the selected tab fills the detail and
|
||||
/// scrolls behind the top bar, the host-built header (a glass strip just
|
||||
/// under the bar) and the floating tab bar.
|
||||
///
|
||||
/// The Graph tab fills its slot with [RunGraphView] from the run's own pinned
|
||||
/// graph and recorded steps. A visited stage click selects that stage's latest
|
||||
@@ -54,7 +56,7 @@ class RunDetailTabs extends StatefulWidget {
|
||||
|
||||
final JsonMap run;
|
||||
|
||||
/// The host's own header: identity, status and the run actions. It stays
|
||||
/// The host's own header: status, the run actions and notices. It floats
|
||||
/// outside the tab body, so switching tabs never drops an action.
|
||||
final Widget header;
|
||||
|
||||
@@ -297,35 +299,25 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
|
||||
onClose: () => Navigator.of(pageContext).pop(),
|
||||
)
|
||||
: const Center(child: Text('This visit is no longer recorded.'));
|
||||
// The pane names the visit; the bar names the run it belongs to.
|
||||
final title = detailTitle(run);
|
||||
if (cupertino) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: SegmentedBar(
|
||||
cupertino: true,
|
||||
leading: SegmentedBackButton(
|
||||
key: const Key('run-visit-back'),
|
||||
cupertino: true,
|
||||
onPressed: () => Navigator.of(pageContext).pop(),
|
||||
),
|
||||
title: title,
|
||||
),
|
||||
child: SafeArea(child: pane),
|
||||
);
|
||||
}
|
||||
return Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: SegmentedBar(
|
||||
cupertino: false,
|
||||
leading: SegmentedBackButton(
|
||||
key: const Key('run-visit-back'),
|
||||
cupertino: false,
|
||||
onPressed: () => Navigator.of(pageContext).pop(),
|
||||
),
|
||||
title: title,
|
||||
// The bar names the stage over its visit and run, so the body
|
||||
// repeats neither; the sections scroll behind it.
|
||||
final known = index < visits.length;
|
||||
final bar = SegmentedBar(
|
||||
cupertino: cupertino,
|
||||
leading: SegmentedBackButton(
|
||||
key: const Key('run-visit-back'),
|
||||
cupertino: cupertino,
|
||||
onPressed: () => Navigator.of(pageContext).pop(),
|
||||
),
|
||||
body: SafeArea(child: pane),
|
||||
title: known ? visits[index].stage : detailTitle(run),
|
||||
titleKey: const Key('run-visit-title'),
|
||||
subtitle: known ? runVisitSubtitle(run, visits[index]) : null,
|
||||
);
|
||||
final body = SafeArea(top: false, bottom: false, child: pane);
|
||||
if (cupertino) {
|
||||
return CupertinoPageScaffold(navigationBar: bar, child: body);
|
||||
}
|
||||
return Scaffold(extendBodyBehindAppBar: true, appBar: bar, body: body);
|
||||
},
|
||||
);
|
||||
final route = cupertino
|
||||
@@ -368,42 +360,41 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final headerLimit = _headerLimit(constraints);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
// The header (status, actions, notices) starts below the floating
|
||||
// top bar; the tab body below it no longer sees the bar's height.
|
||||
ConstrainedBox(
|
||||
// The header (status, actions, notices) is a glass strip floating
|
||||
// just under the top bar, so every tab scrolls behind both and pads
|
||||
// its first item clear of them at rest. Below it, the tabs float over
|
||||
// the tab, at its bottom on a page or at its top beside a list, and
|
||||
// the tab learns their height as its padding on that edge too. Every
|
||||
// tab gets the whole height: the scrolling tabs own their content and
|
||||
// the Graph tab fills the slot, so its canvas is never asked for an
|
||||
// unbounded extent.
|
||||
return FloatingBarOverlay(
|
||||
edge: FloatingBarEdge.top,
|
||||
bar: TopGlassStrip(
|
||||
key: const Key('run-detail-header'),
|
||||
cupertino: widget.cupertino,
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxHeight: headerLimit),
|
||||
child: SingleChildScrollView(
|
||||
key: ValueKey('run-detail-header-${widget.run['id']}'),
|
||||
padding: EdgeInsets.only(top: topBarInset(context)),
|
||||
child: widget.header,
|
||||
),
|
||||
),
|
||||
// Every tab gets the bounded remaining height. The scrolling tabs
|
||||
// own their content; the Graph tab fills the slot so its canvas is
|
||||
// never asked for an unbounded extent. The tabs float over the
|
||||
// tab, at its bottom on a page or at its top beside a list, and
|
||||
// the tab learns their height as its padding on that edge.
|
||||
Expanded(
|
||||
key: ValueKey('run-detail-body-${widget.run['id']}'),
|
||||
child: MediaQuery.removePadding(
|
||||
context: context,
|
||||
removeTop: true,
|
||||
child: FloatingBarOverlay(
|
||||
edge: edge,
|
||||
bar: RunDetailTabStrip(
|
||||
tabs: tabs,
|
||||
edge: edge,
|
||||
selected: shown,
|
||||
onSelected: (tab) => setState(() => _tab = tab),
|
||||
),
|
||||
child: _body(shown),
|
||||
),
|
||||
),
|
||||
child: KeyedSubtree(
|
||||
key: ValueKey('run-detail-body-${widget.run['id']}'),
|
||||
child: FloatingBarOverlay(
|
||||
edge: edge,
|
||||
bar: RunDetailTabStrip(
|
||||
tabs: tabs,
|
||||
edge: edge,
|
||||
selected: shown,
|
||||
onSelected: (tab) => setState(() => _tab = tab),
|
||||
),
|
||||
child: _body(shown),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -429,12 +420,15 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
|
||||
),
|
||||
);
|
||||
case RunDetailTab.graph:
|
||||
return RunGraphView(
|
||||
key: const Key('run-detail-graph'),
|
||||
graph: detailGraph(widget.run),
|
||||
run: widget.run,
|
||||
selectedStage: _selectedStage,
|
||||
onStageSelected: _openStage,
|
||||
// A canvas with its own overlay controls starts below the header.
|
||||
return BelowTopBar(
|
||||
child: RunGraphView(
|
||||
key: const Key('run-detail-graph'),
|
||||
graph: detailGraph(widget.run),
|
||||
run: widget.run,
|
||||
selectedStage: _selectedStage,
|
||||
onStageSelected: _openStage,
|
||||
),
|
||||
);
|
||||
case RunDetailTab.input:
|
||||
return runDetailFieldTab(
|
||||
|
||||
@@ -1,20 +1,14 @@
|
||||
import '../../../ui/status/run_status_icon.dart';
|
||||
import '../../graph/widgets/graph_stage_node.dart' show graphStatusState;
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import 'run_detail_content.dart';
|
||||
import 'run_detail_visit_facts.dart';
|
||||
import 'run_detail_visit_facts_view.dart';
|
||||
import 'run_detail_visit_sections.dart';
|
||||
|
||||
/// The selected recorded visit inside the Timeline tab.
|
||||
///
|
||||
/// It leads with the visit's own headline facts, then native tabbed sections.
|
||||
/// A fact the reply did not record is not drawn at all; a blank verdict or
|
||||
/// diagnostic is not rendered as an empty decision.
|
||||
/// The selected recorded visit's page body: its sections under floating
|
||||
/// tabs. The page's bar carries the stage and its coordinates
|
||||
/// ([runVisitSubtitle]); the Summary section leads with the visit's facts.
|
||||
class RunVisitPane extends StatefulWidget {
|
||||
const RunVisitPane({
|
||||
super.key,
|
||||
@@ -68,208 +62,42 @@ class _RunVisitPaneState extends State<RunVisitPane> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final style = _VisitStyle.of(context);
|
||||
final facts = detailVisitFacts(widget.step);
|
||||
final verdict = detailVisitVerdict(widget.step);
|
||||
final diagnostic = detailVisitDiagnostic(widget.step);
|
||||
// The facts take what they need, up to 40% of the height (then scroll);
|
||||
// the section fills everything else, so the tabs always end at the
|
||||
// bottom of the screen however short the facts or the section are.
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) => Column(
|
||||
key: const Key('run-visit-pane'),
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(maxHeight: constraints.maxHeight * 0.4),
|
||||
child: SingleChildScrollView(
|
||||
key: const Key('run-visit-facts'),
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 0, 16, 8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_bar(style),
|
||||
_FactGrid(facts: facts, style: style),
|
||||
if (verdict != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text('Verdict', style: style.heading),
|
||||
if (verdict.option != null) Text(verdict.option!),
|
||||
if (verdict.reason != null)
|
||||
Text(verdict.reason!, style: style.value),
|
||||
],
|
||||
if (diagnostic != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text('Diagnostic', style: style.heading),
|
||||
Text(diagnostic, style: style.value),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// The sections are floating tabs over the bottom of what they
|
||||
// show; the section learns their height as bottom padding.
|
||||
Expanded(
|
||||
child: FloatingBarOverlay(
|
||||
bar: RunVisitSectionStrip(
|
||||
selected: _section,
|
||||
onSelected: (section) => setState(() => _section = section),
|
||||
),
|
||||
child: runVisitSectionBody(
|
||||
section: _section,
|
||||
run: widget.run,
|
||||
step: widget.step,
|
||||
visitIndex: widget.visitIndex,
|
||||
stageKey: widget.visit.stage,
|
||||
runSteps: widget.runSteps,
|
||||
gateway: widget.gateway,
|
||||
onRunChanged: widget.onRunChanged,
|
||||
configuredEndpoint: widget.configuredEndpoint,
|
||||
cupertino: widget.cupertino,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Keep stage identity visually distinct from the visit/run coordinates.
|
||||
/// Back is the page bar's; this heading is the selected recorded stage.
|
||||
Widget _bar(_VisitStyle style) {
|
||||
final runId = '${widget.run['id'] ?? ''}'.trim();
|
||||
return Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(0, 8, 0, 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Semantics(
|
||||
container: true,
|
||||
header: true,
|
||||
identifier: 'run-stage-heading',
|
||||
child: Text(
|
||||
widget.visit.stage,
|
||||
key: const Key('run-visit-title'),
|
||||
style: style.stageTitle,
|
||||
softWrap: true,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Wrap(
|
||||
spacing: 12,
|
||||
runSpacing: 4,
|
||||
children: [
|
||||
if (widget.visit.sequence != null)
|
||||
Text('Visit ${widget.visit.sequence}', style: style.muted),
|
||||
if (runId.isNotEmpty) Text('Run $runId', style: style.muted),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The visit's facts several to a line: status and outcome as coloured
|
||||
/// pills, a long value (the model) on a line of its own.
|
||||
class _FactGrid extends StatelessWidget {
|
||||
const _FactGrid({required this.facts, required this.style});
|
||||
|
||||
final List<VisitFact> facts;
|
||||
final _VisitStyle style;
|
||||
|
||||
static String _stateOf(VisitFact fact) {
|
||||
final value = fact.value.trim().toLowerCase();
|
||||
if (fact.label == 'Outcome') {
|
||||
if (value == 'error' || value == 'failed' || value == 'blocked') {
|
||||
return 'failed';
|
||||
}
|
||||
if (value == 'success') return 'succeeded';
|
||||
return 'running';
|
||||
}
|
||||
return graphStatusState(fact.value);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Wrap(
|
||||
key: const Key('run-visit-facts-grid'),
|
||||
spacing: 16,
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
for (final fact in facts)
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(fact.label, style: style.muted),
|
||||
const SizedBox(height: 2),
|
||||
if (fact.label == 'Status' || fact.label == 'Outcome')
|
||||
_pill(context, fact)
|
||||
else
|
||||
Text(fact.value, style: style.value),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _pill(BuildContext context, VisitFact fact) {
|
||||
final color = runStatusColor(_stateOf(fact)).resolveFrom(context);
|
||||
return DecoratedBox(
|
||||
decoration: ShapeDecoration(
|
||||
color: color.withValues(alpha: 0.16),
|
||||
shape: const StadiumBorder(),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
child: Text(
|
||||
fact.value,
|
||||
style: style.value.copyWith(
|
||||
color: color,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
// The section fills the page and scrolls behind the page's top bar (which
|
||||
// names the stage and its visit) and the floating tabs, padding its
|
||||
// content clear of both at rest. Summary leads with the visit's facts.
|
||||
return KeyedSubtree(
|
||||
key: const Key('run-visit-pane'),
|
||||
child: FloatingBarOverlay(
|
||||
bar: RunVisitSectionStrip(
|
||||
selected: _section,
|
||||
onSelected: (section) => setState(() => _section = section),
|
||||
),
|
||||
child: runVisitSectionBody(
|
||||
section: _section,
|
||||
run: widget.run,
|
||||
step: widget.step,
|
||||
visitIndex: widget.visitIndex,
|
||||
stageKey: widget.visit.stage,
|
||||
runSteps: widget.runSteps,
|
||||
gateway: widget.gateway,
|
||||
onRunChanged: widget.onRunChanged,
|
||||
configuredEndpoint: widget.configuredEndpoint,
|
||||
cupertino: widget.cupertino,
|
||||
facts: RunVisitFactsView(step: widget.step),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Host text roles only: no palette, font family or explicit size.
|
||||
class _VisitStyle {
|
||||
const _VisitStyle({
|
||||
required this.value,
|
||||
required this.muted,
|
||||
required this.heading,
|
||||
required this.stageTitle,
|
||||
});
|
||||
|
||||
factory _VisitStyle.of(BuildContext context) {
|
||||
if (usesCupertinoHost(context)) {
|
||||
final theme = CupertinoTheme.of(context);
|
||||
final secondary = CupertinoColors.secondaryLabel.resolveFrom(context);
|
||||
return _VisitStyle(
|
||||
value: theme.textTheme.textStyle,
|
||||
muted: theme.textTheme.textStyle.copyWith(color: secondary),
|
||||
heading: theme.textTheme.navTitleTextStyle,
|
||||
stageTitle: theme.textTheme.navLargeTitleTextStyle,
|
||||
);
|
||||
}
|
||||
final theme = Theme.of(context);
|
||||
return _VisitStyle(
|
||||
value: theme.textTheme.bodyMedium ?? const TextStyle(),
|
||||
muted: (theme.textTheme.bodySmall ?? const TextStyle()).copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
heading: theme.textTheme.titleSmall ?? const TextStyle(),
|
||||
stageTitle: theme.textTheme.headlineSmall ?? const TextStyle(),
|
||||
);
|
||||
}
|
||||
|
||||
final TextStyle value;
|
||||
final TextStyle muted;
|
||||
final TextStyle heading;
|
||||
final TextStyle stageTitle;
|
||||
/// The page bar's subtitle for a recorded visit: its sequence, then the run
|
||||
/// it belongs to (`Visit 2 · Run 7 · Nightly report`).
|
||||
String runVisitSubtitle(JsonMap run, DetailVisit visit) {
|
||||
final runId = '${run['id'] ?? ''}'.trim();
|
||||
final title = detailTitle(run);
|
||||
return [
|
||||
if (visit.sequence != null) 'Visit ${visit.sequence}',
|
||||
if (runId.isNotEmpty) 'Run $runId',
|
||||
if (title.isNotEmpty && title != 'Run $runId') title,
|
||||
].join(' · ');
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../graph/widgets/stage_definition_view.dart';
|
||||
import 'run_detail_content.dart';
|
||||
import 'run_detail_visit_facts.dart';
|
||||
@@ -26,7 +27,7 @@ class RunVisitDefinition extends StatelessWidget {
|
||||
if (!detailVisitHasDefinition(graph, stageKey)) {
|
||||
return ListView(
|
||||
key: const Key('run-visit-body-definition'),
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: withBarClearance(context, const EdgeInsets.all(16)),
|
||||
children: const [Text(unknownStageDefinition)],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../../ui/status/run_status_icon.dart';
|
||||
import '../../graph/widgets/graph_stage_node.dart' show graphStatusState;
|
||||
import 'run_detail_visit_facts.dart';
|
||||
|
||||
/// A recorded visit's facts, verdict and diagnostic: the head of the stage
|
||||
/// page's Summary, scrolling with it behind the top bar. The stage and its
|
||||
/// coordinates are the page bar's title and subtitle, so they are not
|
||||
/// repeated here. A fact the reply did not record is not drawn at all; a
|
||||
/// blank verdict or diagnostic is not rendered as an empty decision.
|
||||
class RunVisitFactsView extends StatelessWidget {
|
||||
const RunVisitFactsView({super.key, required this.step});
|
||||
|
||||
final JsonMap step;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final style = _VisitStyle.of(context);
|
||||
final facts = detailVisitFacts(step);
|
||||
final verdict = detailVisitVerdict(step);
|
||||
final diagnostic = detailVisitDiagnostic(step);
|
||||
return Padding(
|
||||
key: const Key('run-visit-facts'),
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 8, 16, 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_FactGrid(facts: facts, style: style),
|
||||
if (verdict != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text('Verdict', style: style.heading),
|
||||
if (verdict.option != null) Text(verdict.option!),
|
||||
if (verdict.reason != null)
|
||||
Text(verdict.reason!, style: style.value),
|
||||
],
|
||||
if (diagnostic != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text('Diagnostic', style: style.heading),
|
||||
Text(diagnostic, style: style.value),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The visit's facts several to a line: status and outcome as coloured
|
||||
/// pills, a long value (the model) on a line of its own.
|
||||
class _FactGrid extends StatelessWidget {
|
||||
const _FactGrid({required this.facts, required this.style});
|
||||
|
||||
final List<VisitFact> facts;
|
||||
final _VisitStyle style;
|
||||
|
||||
static String _stateOf(VisitFact fact) {
|
||||
final value = fact.value.trim().toLowerCase();
|
||||
if (fact.label == 'Outcome') {
|
||||
if (value == 'error' || value == 'failed' || value == 'blocked') {
|
||||
return 'failed';
|
||||
}
|
||||
if (value == 'success') return 'succeeded';
|
||||
return 'running';
|
||||
}
|
||||
return graphStatusState(fact.value);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Wrap(
|
||||
key: const Key('run-visit-facts-grid'),
|
||||
spacing: 16,
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
for (final fact in facts)
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(fact.label, style: style.muted),
|
||||
const SizedBox(height: 2),
|
||||
if (fact.label == 'Status' || fact.label == 'Outcome')
|
||||
_pill(context, fact)
|
||||
else
|
||||
Text(fact.value, style: style.value),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _pill(BuildContext context, VisitFact fact) {
|
||||
final color = runStatusColor(_stateOf(fact)).resolveFrom(context);
|
||||
return DecoratedBox(
|
||||
decoration: ShapeDecoration(
|
||||
color: color.withValues(alpha: 0.16),
|
||||
shape: const StadiumBorder(),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
child: Text(
|
||||
fact.value,
|
||||
style: style.value.copyWith(
|
||||
color: color,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Host text roles only: no palette, font family or explicit size.
|
||||
class _VisitStyle {
|
||||
const _VisitStyle({
|
||||
required this.value,
|
||||
required this.muted,
|
||||
required this.heading,
|
||||
});
|
||||
|
||||
factory _VisitStyle.of(BuildContext context) {
|
||||
if (usesCupertinoHost(context)) {
|
||||
final theme = CupertinoTheme.of(context);
|
||||
final secondary = CupertinoColors.secondaryLabel.resolveFrom(context);
|
||||
return _VisitStyle(
|
||||
value: theme.textTheme.textStyle,
|
||||
muted: theme.textTheme.textStyle.copyWith(color: secondary),
|
||||
heading: theme.textTheme.navTitleTextStyle,
|
||||
);
|
||||
}
|
||||
final theme = Theme.of(context);
|
||||
return _VisitStyle(
|
||||
value: theme.textTheme.bodyMedium ?? const TextStyle(),
|
||||
muted: (theme.textTheme.bodySmall ?? const TextStyle()).copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
heading: theme.textTheme.titleSmall ?? const TextStyle(),
|
||||
);
|
||||
}
|
||||
|
||||
final TextStyle value;
|
||||
final TextStyle muted;
|
||||
final TextStyle heading;
|
||||
}
|
||||
@@ -111,6 +111,7 @@ Widget runVisitSectionBody({
|
||||
required ValueChanged<JsonMap> onRunChanged,
|
||||
required String configuredEndpoint,
|
||||
required bool cupertino,
|
||||
Widget? facts,
|
||||
}) {
|
||||
Widget body(RunVisitSection section) => runVisitSectionBody(
|
||||
section: section,
|
||||
@@ -132,6 +133,7 @@ Widget runVisitSectionBody({
|
||||
input: step['input'],
|
||||
output: step['output'],
|
||||
cupertino: cupertino,
|
||||
facts: facts,
|
||||
);
|
||||
case RunVisitSection.more:
|
||||
return body(RunVisitSection.session);
|
||||
@@ -164,12 +166,15 @@ Widget runVisitSectionBody({
|
||||
steps: [step],
|
||||
showSummary: false,
|
||||
);
|
||||
return cupertino
|
||||
? Builder(
|
||||
builder: (context) =>
|
||||
Theme(data: hostTextTheme(context), child: viewer),
|
||||
)
|
||||
: viewer;
|
||||
// The viewer's own header leads it, so it starts below the bar.
|
||||
return BelowTopBar(
|
||||
child: cupertino
|
||||
? Builder(
|
||||
builder: (context) =>
|
||||
Theme(data: hostTextTheme(context), child: viewer),
|
||||
)
|
||||
: viewer,
|
||||
);
|
||||
case RunVisitSection.session:
|
||||
return RunVisitSession(
|
||||
run: run,
|
||||
@@ -189,12 +194,16 @@ class _VisitSummary extends StatefulWidget {
|
||||
required this.input,
|
||||
required this.output,
|
||||
required this.cupertino,
|
||||
this.facts,
|
||||
});
|
||||
|
||||
final dynamic input;
|
||||
final dynamic output;
|
||||
final bool cupertino;
|
||||
|
||||
/// The visit's facts, leading the scroll below the top bar.
|
||||
final Widget? facts;
|
||||
|
||||
@override
|
||||
State<_VisitSummary> createState() => _VisitSummaryState();
|
||||
}
|
||||
@@ -251,6 +260,10 @@ class _VisitSummaryState extends State<_VisitSummary> {
|
||||
Widget build(BuildContext context) => CustomScrollView(
|
||||
key: const Key('run-visit-body-summary'),
|
||||
slivers: [
|
||||
// Starts below the page's bar and scrolls behind it; the sticky
|
||||
// sections pin just below the bar.
|
||||
const SliverTopBarClearance(),
|
||||
if (widget.facts case final facts?) SliverToBoxAdapter(child: facts),
|
||||
_section('Input', widget.input, visitEmptyInput),
|
||||
_section('Output', widget.output, visitEmptyOutput),
|
||||
const SliverFloatingBarClearance(),
|
||||
|
||||
@@ -134,7 +134,7 @@ class _RunVisitSessionState extends State<RunVisitSession> {
|
||||
}
|
||||
return ListView(
|
||||
key: const Key('run-visit-body-session'),
|
||||
padding: withFloatingBarClearance(context, const EdgeInsets.all(16)),
|
||||
padding: withBarClearance(context, const EdgeInsets.all(16)),
|
||||
children: _spaced(children),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user