WIP: flat detail bodies, facts grid, wide run chrome, pipeline summary

This commit is contained in:
2026-10-31 12:09:44 +00:00
parent 06f6eda360
commit 06a52298b1
15 changed files with 472 additions and 372 deletions
@@ -1,4 +1,4 @@
import '../../../ui/theme/app_theme.dart';
import '../../../ui/layout/section_heading.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@@ -41,18 +41,10 @@ class ArtifactDocumentSection extends StatelessWidget {
children: rows,
);
}
if (usesCupertinoHost(context)) {
return CupertinoListSection.insetGrouped(
backgroundColor: AppColors.groupedBackground,
header: Semantics(
container: true,
header: true,
child: const Text('Turn documents'),
),
hasLeading: false,
children: rows,
);
}
// Flat rows under a quiet label on both hosts: the section sits inside
// the visit's Session page, which is itself flat, so a Cupertino inset
// group here would be a group nested in a group.
final cupertino = usesCupertinoHost(context);
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@@ -61,7 +53,10 @@ class ArtifactDocumentSection extends StatelessWidget {
child: Semantics(
container: true,
header: true,
child: const Text('Turn documents'),
child: Text(
'Turn documents',
style: cupertino ? SectionHeadingStyle.of(context).title : null,
),
),
),
...rows,
@@ -1,5 +1,4 @@
import '../../../ui/adaptive/segmented_bar.dart';
import '../../../ui/theme/app_theme.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -395,10 +394,9 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
);
if (widget.embedded) return body;
if (usesCupertinoHost(context)) {
// Flat sections on the page colour, as in the run and stage details;
// their pinned headings take the same colour.
return CupertinoPageScaffold(
// Sections paint the grouped background; the page must match it or a
// white seam shows below the last section in light mode.
backgroundColor: AppColors.groupedBackground,
navigationBar: const SegmentedBar(
cupertino: true,
title: artifactGalleryTitle,
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import '../../../ui/adaptive/host.dart';
import '../domain/artifact_groups.dart';
import '../../../ui/layout/section_heading.dart';
import '../../../ui/layout/sticky_section.dart';
import 'artifact_document_section.dart';
import 'artifact_record_row.dart';
@@ -106,7 +107,14 @@ class _ArtifactVisitListState extends State<ArtifactVisitList> {
final slivers = <Widget>[
if (header != null) SliverToBoxAdapter(child: header),
// The grid/list switch stays reachable while the gallery scrolls.
StickyBar(child: _modeSwitch(context)),
PinnedHeaderSliver(
// On the page colour (that of the pinned section headings), not a
// grouped band.
child: ColoredBox(
color: SectionHeadingStyle.of(context).background,
child: _modeSwitch(context),
),
),
];
for (final group in widget.groups) {
final identity = '${group.stageKey}\u0000${group.visit}';
@@ -1,8 +1,10 @@
import '../../../ui/theme/app_theme.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/layout/app_list_row.dart';
import '../../../ui/layout/facts_grid.dart';
import '../../../ui/layout/section_heading.dart';
import '../../schedules/ui/pipeline/schedule_pipeline_section.dart';
import '../pipeline_format.dart';
import '../pipeline_models.dart';
@@ -11,9 +13,14 @@ import '../pipelines_controller.dart';
import 'pipeline_controls.dart';
import 'pipeline_detail_styles.dart';
/// Summary tab: key/value facts, the pipeline's saved schedules and the version
/// history. Version rows are selectable; the latest version's row is marked and
/// a historical selection offers an explicit return to latest.
/// The Summary's facts grid.
const pipelineSummaryFactsKey = Key('pipeline-summary-facts');
/// Summary tab: the recorded facts as a compact grid, the pipeline's saved
/// schedules and the version history, flat on the page on both hosts (the
/// same structure as the run Summary). Version rows are the app's shared list
/// row; the shown version is the selected row, and a historical selection
/// offers an explicit return to latest.
class PipelineSummaryView extends StatelessWidget {
const PipelineSummaryView({
super.key,
@@ -67,60 +74,62 @@ class PipelineSummaryView extends StatelessWidget {
);
}
/// Only recorded values are facts: a blank one is omitted, not drawn empty.
Widget _fields(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
for (final field in pipelineSummaryFields(detail))
Padding(
padding: const EdgeInsets.only(bottom: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(field.key, style: pipelineMutedStyle(context)),
SelectableText(
field.value,
style: pipelineValueStyle(
context,
monospace: field.monospace,
),
),
],
),
),
],
),
final fields = [
for (final field in pipelineSummaryFields(detail))
if (field.value.trim().isNotEmpty) field,
];
if (fields.isEmpty) return const SizedBox.shrink();
return FactsGrid(
key: pipelineSummaryFactsKey,
cupertino: useCupertinoControls(context),
items: [
for (final field in fields)
FactsGridItem(
key: ValueKey('pipeline-summary-${_slug(field.key)}'),
label: field.key,
value: field.value,
// A hash gets its own line; the host font is kept (the pipeline
// detail does not switch identifiers to monospace).
wide: field.monospace,
),
],
);
}
Widget _versions(BuildContext context) {
final cupertino = useCupertinoControls(context);
final effective = detail.resolvedVersion;
final showingLatest = effective == detail.latestVersion;
final versions = detail.versions;
final rows = <Widget>[
if (!showingLatest)
_versionTile(
context,
AppListRow(
key: const Key('pipeline-latest-version'),
subtitle: 'Return to the latest version',
selected: false,
label: 'View latest v${detail.latestVersion}',
cupertino: cupertino,
title: Text('View latest v${detail.latestVersion}'),
subtitle: const Text('Return to the latest version'),
divider: versions.isNotEmpty,
onTap: () => controller.selectVersion(0),
),
for (final version in detail.versions)
_versionTile(
context,
key: Key('pipeline-version-${version.version}'),
subtitle: [
stageCountText(version.stages),
?formatLocalTimestamp(version.createdAt),
].join(' · '),
selected: version.version == effective,
label: 'v${version.version}',
onTap: () => controller.selectVersion(version.version),
for (var index = 0; index < versions.length; index += 1)
AppListRow(
key: Key('pipeline-version-${versions[index].version}'),
cupertino: cupertino,
selected: versions[index].version == effective,
title: Text('v${versions[index].version}'),
time: formatLocalTimestamp(versions[index].createdAt),
subtitle: Text(
[
stageCountText(versions[index].stages),
if (versions[index].version == detail.latestVersion) 'latest',
].join(' · '),
),
divider: index < versions.length - 1,
onTap: () => controller.selectVersion(versions[index].version),
),
if (detail.versions.isEmpty)
if (versions.isEmpty)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Text(
@@ -129,49 +138,18 @@ class PipelineSummaryView extends StatelessWidget {
),
),
];
if (useCupertinoControls(context)) {
return CupertinoListSection.insetGrouped(
backgroundColor: AppColors.groupedBackground,
header: const Text('VERSIONS'),
children: rows,
);
}
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
child: Text('Versions', style: pipelineSectionStyle(context)),
const SectionHeading(
title: 'Versions',
header: true,
padding: EdgeInsetsDirectional.only(start: 16, end: 8),
),
...rows,
],
);
}
Widget _versionTile(
BuildContext context, {
required Key key,
required String subtitle,
required bool selected,
required String label,
required VoidCallback onTap,
}) {
if (useCupertinoControls(context)) {
return CupertinoListTile(
key: key,
title: Text(label),
subtitle: Text(subtitle),
trailing: selected ? const Icon(CupertinoIcons.check_mark) : null,
onTap: onTap,
);
}
return ListTile(
key: key,
selected: selected,
title: Text(label),
subtitle: Text(subtitle),
trailing: selected ? const Icon(Icons.check) : null,
onTap: onTap,
);
}
}
String _slug(String label) => label.toLowerCase().replaceAll(' ', '-');
@@ -23,9 +23,10 @@ class RunDecisionNotice extends StatelessWidget {
Widget build(BuildContext context) {
final pending = pendingDecision(run);
if (pending == null) return const SizedBox.shrink();
// As the web's `.decision-card`: one full-width banner in the waiting
// colour, with the glyph, the title over its meta line, and the action on
// the trailing edge. The same banner on both hosts.
// One full-width line of the header strip: the glyph in the waiting
// colour, the title over its meta line, and the action on the trailing
// edge. The strip is already the frame, so the banner draws no card,
// border or tint of its own. The same banner on both hosts.
final cupertino = usesCupertinoHost(context);
final color = CupertinoColors.systemTeal.resolveFrom(context);
final metaStyle = cupertino
@@ -36,13 +37,7 @@ class RunDecisionNotice extends StatelessWidget {
return Container(
key: const Key('run-decision-banner'),
width: double.infinity,
margin: const EdgeInsets.only(top: 8),
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
decoration: BoxDecoration(
color: color.withValues(alpha: 0.12),
border: Border.all(color: color),
borderRadius: BorderRadius.circular(10),
),
padding: const EdgeInsets.only(top: 8, bottom: 4),
child: Row(
children: [
Icon(
@@ -1,4 +1,3 @@
import '../../../ui/theme/app_theme.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -8,11 +7,12 @@ import 'run_detail_summary_fields.dart';
import 'run_detail_visit_facts.dart';
import 'run_field_body.dart';
import '../../../ui/adaptive/host.dart';
import '../../../ui/layout/facts_grid.dart';
import '../../../ui/layout/sticky_section.dart';
import '../../../ui/text/monospace.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
/// The Summary tab: the run's identity, the recorded facts as key/value rows,
/// The Summary tab: the run's identity, the recorded facts as one grid,
/// the stored original prompt with its copy control and the collapsible Input
/// and Output sections.
///
@@ -34,9 +34,12 @@ Widget runDetailSummaryTab({
final rows = detailSummaryRows(run);
final identity = detailSummaryIdentity(run);
// No separate "Original prompt": the run's Input carries it, as data.
// The top bar's subtitle already names the run's pipeline (and its title
// opens it), so a Pipeline fact would only repeat it.
final pipelineInBar = '${run['name'] ?? ''}'.trim().isNotEmpty;
final facts = [
for (final row in rows)
if (!row.block) row,
if (!row.block && !(pipelineInBar && row.label == 'Pipeline')) row,
];
return CustomScrollView(
key: const Key('run-detail-tab-body-summary'),
@@ -58,14 +61,22 @@ Widget runDetailSummaryTab({
),
),
),
// The facts sit on the page as one grid, the same on both hosts: no
// grouped card, so a single fact starts at the leading edge.
if (facts.isNotEmpty)
SliverToBoxAdapter(
child: cupertino
? CupertinoListSection.insetGrouped(
backgroundColor: AppColors.groupedBackground,
children: [_summaryFacts(context, facts, cupertino: true)],
)
: _summaryFacts(context, facts, cupertino: false),
child: FactsGrid(
key: const Key('run-detail-summary-facts'),
items: [
for (final row in facts)
FactsGridItem(
key: ValueKey('run-detail-summary-${_slug(row.label)}'),
label: row.label,
value: row.value,
monospace: row.monospace,
),
],
),
),
// Long blocks (the Diagnostic), Input and Output are sticky
// collapsibles: each title stays pinned while its content scrolls.
@@ -200,18 +211,7 @@ Widget runDetailFieldTab({
cupertino: cupertino,
textBuilder: cupertino ? _CupertinoSelectableText.new : null,
);
if (cupertino) {
return ListView(
key: Key('run-detail-tab-body-$tabKey'),
// Clear of a floating tab bar (the list pads its media insets itself).
children: [
CupertinoListSection.insetGrouped(
backgroundColor: AppColors.groupedBackground,
children: [Padding(padding: const EdgeInsets.all(16), child: body)],
),
],
);
}
// Flat on the page on both hosts, like the Summary.
return Builder(
builder: (context) => ListView(
key: Key('run-detail-tab-body-$tabKey'),
@@ -223,76 +223,6 @@ Widget runDetailFieldTab({
// --- Material --------------------------------------------------------------
/// The recorded facts as a compact grid: two short facts per line on a phone,
/// three when wider; a long or monospace value (a path, a hash) takes a whole
/// line so it is never squeezed.
Widget _summaryFacts(
BuildContext context,
List<DetailSummaryRow> rows, {
required bool cupertino,
}) {
final labelStyle = cupertino
? CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith(
color: CupertinoColors.secondaryLabel.resolveFrom(context),
)
: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
);
final TextStyle valueStyle =
(cupertino
? CupertinoTheme.of(context).textTheme.textStyle
: Theme.of(context).textTheme.bodyMedium) ??
const TextStyle();
return Padding(
key: const Key('run-detail-summary-facts'),
padding: const EdgeInsets.fromLTRB(16, 12, 16, 12),
child: LayoutBuilder(
builder: (context, constraints) {
const gap = 16.0;
final columns = constraints.maxWidth >= 600 ? 3 : 2;
final cell = (constraints.maxWidth - gap * (columns - 1)) / columns;
return Wrap(
spacing: gap,
runSpacing: 12,
children: [
for (final row in rows)
SizedBox(
key: ValueKey('run-detail-summary-${_slug(row.label)}'),
width: row.monospace || row.value.length > 28
? constraints.maxWidth
: cell,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(row.label, style: labelStyle),
const SizedBox(height: 2),
cupertino
? Text(
row.value,
style: row.monospace
? valueStyle.copyWith(
fontFamily: appMonospaceFamily,
)
: valueStyle,
)
: SelectableText(
row.value,
style: row.monospace
? valueStyle.copyWith(
fontFamily: appMonospaceFamily,
)
: valueStyle,
),
],
),
),
],
);
},
),
);
}
/// A long recorded block (the Diagnostic) starts collapsed under its label.
Widget _materialBlock(BuildContext context, DetailSummaryRow row) {
final theme = Theme.of(context);
+35 -20
View File
@@ -19,6 +19,7 @@ import 'run_detail_tab_bodies.dart';
import 'run_detail_tab_strip.dart';
import 'run_detail_timeline.dart';
import 'run_detail_visit.dart';
import 'run_detail_wide_chrome.dart';
import 'run_detail_visit_facts.dart';
import 'run_search_selection.dart';
@@ -360,6 +361,38 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
return LayoutBuilder(
builder: (context, constraints) {
final headerLimit = _headerLimit(constraints);
final header = ConstrainedBox(
constraints: BoxConstraints(maxHeight: headerLimit),
child: SingleChildScrollView(
key: ValueKey('run-detail-header-${widget.run['id']}'),
child: widget.header,
),
);
final tabStrip = RunDetailTabStrip(
tabs: tabs,
edge: edge,
selected: shown,
onSelected: (tab) => setState(() => _tab = tab),
);
final body = KeyedSubtree(
key: ValueKey('run-detail-body-${widget.run['id']}'),
child: _body(shown),
);
if (edge == FloatingBarEdge.top &&
constraints.maxWidth >= kRunDetailWideChromeMinWidth) {
// Beside a list the tabs and the header share one row under the
// pane's bar, so only that row (not a header strip over a tabs
// strip) sits above the tab's content.
return FloatingBarOverlay(
edge: FloatingBarEdge.top,
bar: RunDetailWideChrome(
cupertino: widget.cupertino,
tabs: tabStrip,
header: header,
),
child: body,
);
}
// 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
@@ -374,27 +407,9 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
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']}'),
child: widget.header,
),
),
),
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),
),
child: header,
),
child: FloatingBarOverlay(edge: edge, bar: tabStrip, child: body),
);
},
);
@@ -1,13 +1,16 @@
import '../../../ui/theme/app_theme.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import '../../../ui/layout/app_list_avatar.dart';
import '../../../ui/layout/app_list_row.dart';
import '../../../ui/status/run_status_icon.dart';
import '../domain/run_models.dart';
import 'run_detail_content.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
/// The Timeline tab's recorded visits, one native row per visit.
/// The Timeline tab's recorded visits, one shared list row per visit.
///
/// The list is flat on the page on both hosts, like the runs list and the
/// Summary, with inset dividers between rows (no grouped card).
///
/// [onSelected] receives the row's index in [visits], so the caller opens
/// exactly the recorded step it was built from. [selectedSequence] highlights a
@@ -38,37 +41,25 @@ class RunTimelineList extends StatelessWidget {
children: const [Text('No visits recorded.')],
);
}
final rows = [
for (var index = 0; index < visits.length; index += 1)
RunTimelineRow(
key: ValueKey(
'run-timeline-visit-${visits[index].sequence ?? index}',
),
visit: visits[index],
selected: visits[index].sequence == selectedSequence,
cupertino: cupertino,
onTap: onSelected == null ? null : () => onSelected!(index),
),
];
if (cupertino) {
return ListView(
key: const Key('run-detail-tab-body-timeline'),
children: [
CupertinoListSection.insetGrouped(
backgroundColor: AppColors.groupedBackground,
header: const Text('Timeline'),
children: rows,
),
],
);
}
return ListView(
key: const Key('run-detail-tab-body-timeline'),
padding: withBarClearance(
context,
const EdgeInsets.symmetric(vertical: 8),
),
children: rows,
children: [
for (var index = 0; index < visits.length; index += 1)
RunTimelineRow(
key: ValueKey(
'run-timeline-visit-${visits[index].sequence ?? index}',
),
visit: visits[index],
selected: visits[index].sequence == selectedSequence,
cupertino: cupertino,
divider: index < visits.length - 1,
onTap: onSelected == null ? null : () => onSelected!(index),
),
],
);
}
}
@@ -82,12 +73,14 @@ class RunTimelineRow extends StatelessWidget {
required this.visit,
required this.selected,
required this.cupertino,
this.divider = false,
this.onTap,
});
final DetailVisit visit;
final bool selected;
final bool cupertino;
final bool divider;
final VoidCallback? onTap;
/// The visit's state for its glyph: the outcome when it has one (a completed
@@ -100,12 +93,6 @@ class RunTimelineRow extends StatelessWidget {
return runStateOf(visit.status);
}
/// One line under the title: where the visit went and how long it took.
String get _detail => [
if (visit.target.isNotEmpty) '→ ${visit.target}',
?visit.duration,
].join(' · ');
Widget _outcome(BuildContext context) {
final label = visit.outcome.isNotEmpty
? visit.outcome
@@ -130,48 +117,25 @@ class RunTimelineRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
final leading = RunStatusIcon(
state: _state,
label: visit.status.isEmpty ? 'Status unavailable' : visit.status,
size: 22,
);
final title = Text(
visit.title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
);
final detail = _detail;
// The outcome chip leads the second line, so the title keeps the width.
final subtitle = Wrap(
spacing: 8,
runSpacing: 4,
crossAxisAlignment: WrapCrossAlignment.center,
children: [_outcome(context), if (detail.isNotEmpty) Text(detail)],
);
if (cupertino) {
return Semantics(
selected: selected,
child: CupertinoListTile(
leading: leading,
title: title,
subtitle: subtitle,
trailing: const CupertinoListTileChevron(),
backgroundColor: selected
? CupertinoDynamicColor.resolve(
CupertinoColors.secondarySystemFill,
context,
)
: null,
onTap: onTap,
),
);
}
return ListTile(
final state = _state;
// The outcome chip leads the second line, then where the visit went; the
// duration is the row's time.
return AppListRow(
cupertino: cupertino,
selected: selected,
leading: leading,
title: title,
subtitle: subtitle,
divider: divider,
onTap: onTap,
leading: AppListAvatar(
foreground: runStatusColor(state).resolveFrom(context),
child: RunStatusIcon(
state: state,
label: visit.status.isEmpty ? 'Status unavailable' : visit.status,
),
),
title: Text(visit.title),
time: visit.duration,
subtitleLeading: _outcome(context),
subtitle: visit.target.isEmpty ? null : Text('→ ${visit.target}'),
);
}
}
@@ -1,4 +1,3 @@
import '../../../ui/theme/app_theme.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@@ -113,25 +112,8 @@ class _RunVisitSessionState extends State<RunVisitSession> {
configuredEndpoint: widget.configuredEndpoint,
),
];
if (usesCupertinoHost(context)) {
return ListView(
key: const Key('run-visit-body-session'),
children: [
CupertinoListSection.insetGrouped(
backgroundColor: AppColors.groupedBackground,
children: [
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: _spaced(children),
),
),
],
),
],
);
}
// Flat on the page on both hosts; the turn documents below are a flat
// titled list too, so nothing is a group nested in a group.
return ListView(
key: const Key('run-visit-body-session'),
padding: withBarClearance(context, const EdgeInsets.all(16)),
@@ -0,0 +1,86 @@
import 'package:flutter/widgets.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import '../../../ui/adaptive/floating_destination_bar.dart';
import '../../../ui/adaptive/glass_pill.dart';
import '../../../ui/adaptive/top_glass_strip.dart';
/// The narrowest detail pane that puts its tabs and header in one row;
/// narrower panes stack the header strip over the tabs.
const double kRunDetailWideChromeMinWidth = kFloatingBarWideWidth;
/// The most of the row the tabs take, leaving the rest to the header.
const double kRunDetailWideTabsShare = 0.6;
/// The run detail's controls beside a list (a wide split): its tabs and its
/// header (status, run actions, notices) share one row under the pane's top
/// bar, instead of stacking the header strip above a second tabs strip.
///
/// The tabs lead, in line with the bar's title; the header follows as a glass
/// piece as wide as its content, and wraps (or scrolls inside its height
/// limit) when the pane is narrow. Float the row with `FloatingBarOverlay`
/// at the top edge so the tab body pads past it at rest. The header keeps the
/// key `run-detail-header`.
class RunDetailWideChrome extends StatelessWidget {
const RunDetailWideChrome({
super.key,
required this.cupertino,
required this.tabs,
required this.header,
});
final bool cupertino;
/// The tab strip at [FloatingBarEdge.top]; it brings its own 12px margins.
final Widget tabs;
/// The header's content, already bounded in height.
final Widget header;
@override
Widget build(BuildContext context) {
final insets = MediaQuery.paddingOf(context);
return Padding(
padding: EdgeInsets.only(left: insets.left),
child: LayoutBuilder(
builder: (context, constraints) => Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// The tabs keep at most 60% of the row, so the header always has
// room for its status and actions (scaled text included).
ConstrainedBox(
constraints: BoxConstraints(
maxWidth: constraints.maxWidth * kRunDetailWideTabsShare,
),
child: tabs,
),
Flexible(
child: Padding(
// The tabs' own trailing margin is the gap before the header.
padding: EdgeInsets.only(
right: FloatingDestinationBar.topMargin + insets.right,
bottom: 8,
),
child: Align(
alignment: AlignmentDirectional.centerStart,
heightFactor: 1,
child: GlassPill(
key: const Key('run-detail-header'),
cupertino: cupertino,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(kTopGlassStripRadius),
),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: header,
),
),
),
),
),
],
),
),
);
}
}
@@ -5,10 +5,14 @@ import '../../../ui/adaptive/segmented_bar.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/host.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import '../../graph/domain/graph_definition.dart';
import '../../graph/widgets/run_graph_view.dart';
const runGraphPreviewKey = ValueKey<String>('run-graph-preview');
/// The muted line shown in place of the preview when the run has no graph.
const runGraphPreviewMissingKey = ValueKey<String>('run-graph-preview-missing');
/// The run graph as a still picture on top of Summary. Tapping it opens the
/// interactive graph full screen; picking a stage there closes it and hands
/// the stage to [onStageSelected].
@@ -31,6 +35,23 @@ class RunGraphPreview extends StatelessWidget {
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
// No graph to draw: one muted line, with no frame and nothing to open.
if (graphNodes(graph).isEmpty) {
return Padding(
key: runGraphPreviewMissingKey,
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
child: Text(
runGraphMissing,
style: cupertino
? CupertinoTheme.of(context).textTheme.textStyle.copyWith(
color: CupertinoColors.secondaryLabel.resolveFrom(context),
)
: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
);
}
final border = cupertino
? CupertinoColors.separator.resolveFrom(context)
: Theme.of(context).colorScheme.outlineVariant;
@@ -1,6 +1,8 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../../ui/adaptive/host.dart';
import '../../../../ui/layout/section_heading.dart';
import '../../domain/saved_schedule.dart';
import '../list/schedule_list_controller.dart';
import 'schedule_pipeline_controller.dart';
@@ -40,17 +42,7 @@ class SchedulePipelineListBody extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 4),
child: _header(context),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
scheduleSectionNote,
style: schedulePipelineMutedStyle(context),
),
),
_header(context),
if (controller.isInitialLoading)
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
@@ -68,8 +60,10 @@ class SchedulePipelineListBody extends StatelessWidget {
else if (controller.hasLoaded && schedules.isEmpty)
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
// The empty state also says what a schedule is, so the section
// needs no standing paragraph.
child: Text(
scheduleSectionEmpty,
'$scheduleSectionEmpty $scheduleSectionNote',
style: schedulePipelineMutedStyle(context),
),
),
@@ -84,35 +78,36 @@ class SchedulePipelineListBody extends StatelessWidget {
);
}
/// The section's quiet heading (the same as Versions and the run Summary's
/// sections) with Add as its one trailing action. There is no Refresh:
/// the section reloads after every accepted change and offers Retry when a
/// load fails.
Widget _header(BuildContext context) {
return Wrap(
spacing: 12,
runSpacing: 4,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Semantics(
header: true,
container: true,
child: Text(
controller.hasLoaded && controller.failure == null
? '$scheduleSectionTitle (${controller.schedules.length})'
: scheduleSectionTitle,
style: schedulePipelineHeadingStyle(context),
),
),
schedulePipelineTextButton(
context,
key: scheduleRefreshKey,
label: scheduleRefreshLabel,
onPressed: controller.isLoading ? null : controller.refresh,
),
schedulePipelineTextButton(
context,
key: scheduleAddKey,
label: scheduleAddLabel,
onPressed: onAdd,
),
],
final cupertino = usesCupertinoHost(context);
final add = cupertino
? CupertinoButton(
key: scheduleAddKey,
padding: EdgeInsets.zero,
minimumSize: const Size.square(44),
onPressed: onAdd,
child: const Icon(
CupertinoIcons.add,
semanticLabel: scheduleAddLabel,
),
)
: IconButton(
key: scheduleAddKey,
tooltip: scheduleAddLabel,
onPressed: onAdd,
icon: const Icon(Icons.add),
);
return SectionHeading(
title: controller.hasLoaded && controller.failure == null
? '$scheduleSectionTitle (${controller.schedules.length})'
: scheduleSectionTitle,
header: true,
padding: const EdgeInsetsDirectional.only(start: 16, end: 4),
trailing: [add],
);
}
@@ -10,7 +10,6 @@ const scheduleSectionEmpty =
'No schedules yet. Add one for each topic or recurring task.';
const scheduleSectionLoading = 'Loading schedules…';
const scheduleAddLabel = 'Add schedule';
const scheduleRefreshLabel = 'Refresh';
const scheduleEditLabel = 'Edit';
const schedulePauseLabel = 'Pause';
const scheduleEnableLabel = 'Enable';
@@ -25,7 +24,6 @@ String scheduleDeleteTitle(String name) => 'Delete $name?';
const scheduleSectionKey = ValueKey<String>('schedule-pipeline-section');
const scheduleAddKey = ValueKey<String>('schedule-pipeline-add');
const scheduleRefreshKey = ValueKey<String>('schedule-pipeline-refresh');
const scheduleDeleteKeepKey = ValueKey<String>('schedule-delete-keep');
const scheduleDeleteConfirmKey = ValueKey<String>('schedule-delete-confirm');
const scheduleDeleteErrorKey = ValueKey<String>('schedule-delete-error');
+123
View File
@@ -0,0 +1,123 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../adaptive/host.dart';
import '../text/monospace.dart';
/// One recorded fact of a detail Summary: a small muted label over its value.
class FactsGridItem {
const FactsGridItem({
required this.label,
required this.value,
this.key,
this.monospace = false,
this.wide = false,
});
final String label;
final String value;
final Key? key;
/// Draws the value in the monospace family (and gives it a whole line).
final bool monospace;
/// Gives the fact a whole line even when its value is short.
final bool wide;
}
/// A value longer than this takes a whole line so it is never squeezed.
const int kFactsGridLongValue = 28;
/// The pane width from which the grid shows three facts per line.
const double kFactsGridThreeColumnWidth = 600;
/// A detail Summary's facts as one compact grid on the page, the same on
/// both hosts and in every detail (run, pipeline): two facts per line on a
/// phone, three from [kFactsGridThreeColumnWidth]; a long, wide or monospace
/// value (a path, a hash) takes a whole line.
///
/// The grid always fills its width and starts at the leading edge, so a
/// single fact is a cell at the start of the line, never a shrunk block
/// centred on the page. It draws no card or group of its own.
class FactsGrid extends StatelessWidget {
const FactsGrid({
super.key,
required this.items,
this.padding = const EdgeInsets.fromLTRB(16, 12, 16, 12),
this.selectable = true,
this.cupertino,
});
final List<FactsGridItem> items;
final EdgeInsetsGeometry padding;
/// Material values are selectable text; Cupertino values stay plain text.
final bool selectable;
/// Overrides the host detection (a feature that picks its style per
/// platform).
final bool? cupertino;
@override
Widget build(BuildContext context) {
final cupertino = this.cupertino ?? usesCupertinoHost(context);
final labelStyle = cupertino
? CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith(
color: CupertinoColors.secondaryLabel.resolveFrom(context),
)
: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
);
final TextStyle valueStyle =
(cupertino
? CupertinoTheme.of(context).textTheme.textStyle
: Theme.of(context).textTheme.bodyMedium) ??
const TextStyle();
return Padding(
padding: padding,
child: LayoutBuilder(
builder: (context, constraints) {
const gap = 16.0;
final width = constraints.maxWidth;
final columns = width >= kFactsGridThreeColumnWidth ? 3 : 2;
final cell = (width - gap * (columns - 1)) / columns;
return SizedBox(
width: width,
child: Wrap(
spacing: gap,
runSpacing: 12,
children: [
for (final item in items)
SizedBox(
key: item.key,
width:
item.wide ||
item.monospace ||
item.value.length > kFactsGridLongValue
? width
: cell,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(item.label, style: labelStyle),
const SizedBox(height: 2),
_value(item, valueStyle, cupertino),
],
),
),
],
),
);
},
),
);
}
Widget _value(FactsGridItem item, TextStyle base, bool cupertino) {
final style = item.monospace
? base.copyWith(fontFamily: appMonospaceFamily)
: base;
if (cupertino || !selectable) return Text(item.value, style: style);
return SelectableText(item.value, style: style);
}
}
+24 -12
View File
@@ -24,12 +24,15 @@ class SectionHeadingStyle {
static SectionHeadingStyle of(BuildContext context) {
if (usesCupertinoHost(context)) {
final base = CupertinoTheme.of(context).textTheme.textStyle;
final theme = CupertinoTheme.of(context);
final base = theme.textTheme.textStyle;
// The detail pages (run, stage, pipeline) are flat on the page colour,
// as on Material, so a pinned heading's scrim is the page itself rather
// than a grey grouped band (black in dark mode).
final page = theme.scaffoldBackgroundColor;
return SectionHeadingStyle(
background: CupertinoColors.systemGroupedBackground.resolveFrom(
context,
),
body: CupertinoColors.systemGroupedBackground.resolveFrom(context),
background: page,
body: page,
accent: CupertinoTheme.of(context).primaryColor,
title: base.copyWith(
fontSize: 13,
@@ -66,6 +69,7 @@ class SectionHeading extends StatelessWidget {
this.titleColor,
this.padding = const EdgeInsetsDirectional.only(start: 12, end: 8),
this.minHeight = 40,
this.header = false,
});
final String title;
@@ -75,6 +79,10 @@ class SectionHeading extends StatelessWidget {
final EdgeInsetsGeometry padding;
final double minHeight;
/// Announces the title as a heading to assistive tech (the trailing
/// controls stay separate nodes).
final bool header;
@override
Widget build(BuildContext context) {
final style = SectionHeadingStyle.of(context);
@@ -86,13 +94,17 @@ class SectionHeading extends StatelessWidget {
children: [
if (leading != null) ...[leading!, const SizedBox(width: 8)],
Expanded(
child: Text(
title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: titleColor == null
? style.title
: style.title.copyWith(color: titleColor),
child: Semantics(
header: header,
container: header,
child: Text(
title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: titleColor == null
? style.title
: style.title.copyWith(color: titleColor),
),
),
),
...trailing,