diff --git a/app/lib/features/artifacts/ui/artifact_document_section.dart b/app/lib/features/artifacts/ui/artifact_document_section.dart index 5ee306cb..fb4df48f 100644 --- a/app/lib/features/artifacts/ui/artifact_document_section.dart +++ b/app/lib/features/artifacts/ui/artifact_document_section.dart @@ -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, diff --git a/app/lib/features/artifacts/ui/artifact_gallery_page.dart b/app/lib/features/artifacts/ui/artifact_gallery_page.dart index b3b06c1f..66f0d3a7 100644 --- a/app/lib/features/artifacts/ui/artifact_gallery_page.dart +++ b/app/lib/features/artifacts/ui/artifact_gallery_page.dart @@ -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 { ); 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, diff --git a/app/lib/features/artifacts/ui/artifact_visit_list.dart b/app/lib/features/artifacts/ui/artifact_visit_list.dart index be9ed1ea..9051ed50 100644 --- a/app/lib/features/artifacts/ui/artifact_visit_list.dart +++ b/app/lib/features/artifacts/ui/artifact_visit_list.dart @@ -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 { final slivers = [ 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}'; diff --git a/app/lib/features/pipelines/widgets/pipeline_summary_view.dart b/app/lib/features/pipelines/widgets/pipeline_summary_view.dart index 52fc0745..2fca4006 100644 --- a/app/lib/features/pipelines/widgets/pipeline_summary_view.dart +++ b/app/lib/features/pipelines/widgets/pipeline_summary_view.dart @@ -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 = [ 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(' ', '-'); diff --git a/app/lib/features/runs/ui/run_decision_notice.dart b/app/lib/features/runs/ui/run_decision_notice.dart index 24cd7732..5a9a6f81 100644 --- a/app/lib/features/runs/ui/run_decision_notice.dart +++ b/app/lib/features/runs/ui/run_decision_notice.dart @@ -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( diff --git a/app/lib/features/runs/ui/run_detail_tab_bodies.dart b/app/lib/features/runs/ui/run_detail_tab_bodies.dart index a6674623..fd5ae2c6 100644 --- a/app/lib/features/runs/ui/run_detail_tab_bodies.dart +++ b/app/lib/features/runs/ui/run_detail_tab_bodies.dart @@ -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 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); diff --git a/app/lib/features/runs/ui/run_detail_tabs.dart b/app/lib/features/runs/ui/run_detail_tabs.dart index 1daffb40..2a93435e 100644 --- a/app/lib/features/runs/ui/run_detail_tabs.dart +++ b/app/lib/features/runs/ui/run_detail_tabs.dart @@ -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 { 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 { 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), ); }, ); diff --git a/app/lib/features/runs/ui/run_detail_timeline.dart b/app/lib/features/runs/ui/run_detail_timeline.dart index e7ac986d..60372328 100644 --- a/app/lib/features/runs/ui/run_detail_timeline.dart +++ b/app/lib/features/runs/ui/run_detail_timeline.dart @@ -1,14 +1,17 @@ -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/outcome_palette.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 @@ -42,38 +45,26 @@ class RunTimelineList extends StatelessWidget { // One colour per distinct outcome name across the whole run, so the same // outcome reads the same on every row and different ones never match. final palette = OutcomePalette(visits.map((visit) => visit.outcome)); - 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, - palette: palette, - 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, + palette: palette, + onTap: onSelected == null ? null : () => onSelected!(index), + ), + ], ); } } @@ -87,6 +78,7 @@ class RunTimelineRow extends StatelessWidget { required this.visit, required this.selected, required this.cupertino, + this.divider = false, this.onTap, this.palette, }); @@ -94,6 +86,7 @@ class RunTimelineRow extends StatelessWidget { final DetailVisit visit; final bool selected; final bool cupertino; + final bool divider; final VoidCallback? onTap; /// The run's outcome colours; without one the row colours its own outcome @@ -110,12 +103,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 @@ -147,48 +134,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}'), ); } } diff --git a/app/lib/features/runs/ui/run_detail_visit_session.dart b/app/lib/features/runs/ui/run_detail_visit_session.dart index 5a0d8a39..632666e1 100644 --- a/app/lib/features/runs/ui/run_detail_visit_session.dart +++ b/app/lib/features/runs/ui/run_detail_visit_session.dart @@ -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 { 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)), diff --git a/app/lib/features/runs/ui/run_detail_wide_chrome.dart b/app/lib/features/runs/ui/run_detail_wide_chrome.dart new file mode 100644 index 00000000..abc1c5da --- /dev/null +++ b/app/lib/features/runs/ui/run_detail_wide_chrome.dart @@ -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, + ), + ), + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/app/lib/features/runs/ui/run_graph_preview.dart b/app/lib/features/runs/ui/run_graph_preview.dart index f2e30e92..ac271f6d 100644 --- a/app/lib/features/runs/ui/run_graph_preview.dart +++ b/app/lib/features/runs/ui/run_graph_preview.dart @@ -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('run-graph-preview'); +/// The muted line shown in place of the preview when the run has no graph. +const runGraphPreviewMissingKey = ValueKey('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; diff --git a/app/lib/features/schedules/ui/pipeline/schedule_pipeline_list_body.dart b/app/lib/features/schedules/ui/pipeline/schedule_pipeline_list_body.dart index 55310f2c..ceef4665 100644 --- a/app/lib/features/schedules/ui/pipeline/schedule_pipeline_list_body.dart +++ b/app/lib/features/schedules/ui/pipeline/schedule_pipeline_list_body.dart @@ -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], ); } diff --git a/app/lib/features/schedules/ui/pipeline/schedule_pipeline_wording.dart b/app/lib/features/schedules/ui/pipeline/schedule_pipeline_wording.dart index 1abcf429..11e92d8c 100644 --- a/app/lib/features/schedules/ui/pipeline/schedule_pipeline_wording.dart +++ b/app/lib/features/schedules/ui/pipeline/schedule_pipeline_wording.dart @@ -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('schedule-pipeline-section'); const scheduleAddKey = ValueKey('schedule-pipeline-add'); -const scheduleRefreshKey = ValueKey('schedule-pipeline-refresh'); const scheduleDeleteKeepKey = ValueKey('schedule-delete-keep'); const scheduleDeleteConfirmKey = ValueKey('schedule-delete-confirm'); const scheduleDeleteErrorKey = ValueKey('schedule-delete-error'); diff --git a/app/lib/ui/layout/facts_grid.dart b/app/lib/ui/layout/facts_grid.dart new file mode 100644 index 00000000..cac2a05c --- /dev/null +++ b/app/lib/ui/layout/facts_grid.dart @@ -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 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); + } +} diff --git a/app/lib/ui/layout/section_heading.dart b/app/lib/ui/layout/section_heading.dart index 3c1e2dd1..9a99ab00 100644 --- a/app/lib/ui/layout/section_heading.dart +++ b/app/lib/ui/layout/section_heading.dart @@ -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, diff --git a/app/notes/detail-bodies-fixes.md b/app/notes/detail-bodies-fixes.md new file mode 100644 index 00000000..aa12a6d5 --- /dev/null +++ b/app/notes/detail-bodies-fixes.md @@ -0,0 +1,170 @@ +# Run, stage and pipeline detail bodies (style review round 2: B, C, E) + +These are fixes from the second style review +(`/tmp/app-style-review-r2/report-summary.md`): + +- P1-2: Cupertino summary pages were a patchwork of grouped bands. +- P2-2: run detail chrome. +- P2-3: the pipeline Summary read as a document. + +The shell, the floating destination bar, templates, settings, chat, +`segmented_bar*.dart` and `sticky_section.dart` were out of scope and are +untouched. + +## One approach: flat on the page, both hosts + +The run detail, the stage (visit) page and the pipeline detail now use the +flat list style on both hosts, as Material already did. The Cupertino page +stays the theme's page colour (`AppColors.background`: white, or `#141416` in +dark mode). Content sits directly on it: + +- facts as a grid; +- sections under quiet headings; +- rows as `AppListRow` with inset dividers. + +There is no `CupertinoListSection.insetGrouped` left in these bodies, so no +group can be nested inside another. Settings and Templates keep their grouped +background. They are lists of settings and choices, not detail documents. + +- `SectionHeadingStyle` (`lib/ui/layout/section_heading.dart`): + - On Cupertino, the background and body are now the theme's + `scaffoldBackgroundColor`, not `systemGroupedBackground`. Pinned sticky + headings (Input/Output, the artifact groups) used to be grey bands, or + black bands in dark mode. They now blend into the page, as on Material. + `sticky_section.dart` itself is unchanged. + - New `header` flag: it marks the title (only) as a heading for semantics. +- `FactsGrid` (`lib/ui/layout/facts_grid.dart`, new) is shared by the run and + pipeline Summaries: + - two facts per line below 600 wide, three from 600; + - a long (over 28 characters), `wide` or monospace value takes a whole line; + - the `Wrap` is wrapped in a full-width `SizedBox`, so a single fact sits at + x=16 instead of a half-width card centred on the page; + - no card of its own; + - optional `cupertino` override. +- Run Summary (`run_detail_tab_bodies.dart`): + - the facts are a `FactsGrid`, keeping `run-detail-summary-facts` and the + `run-detail-summary-` cell keys; + - the Cupertino Input/Output field tabs no longer wrap the body in an inset + group; + - the old `_summaryFacts` was removed. +- Timeline (`run_detail_timeline.dart`): + - rows are `AppListRow` with the status avatar (as in the runs list); + - the title is the visit, the time is the duration, and the line is the + outcome chip then `→ target`; + - inset dividers between rows, on a flat list on both hosts; + - the "Timeline" group header and the `CupertinoListTile`/`ListTile` are + gone; + - the keys `run-timeline-visit-` and `run-detail-tab-body-timeline` + are kept. +- Stage Session (`run_detail_visit_session.dart`): the Cupertino inset group + is gone, and the body is the same padded flat list as on Material. +- `ArtifactDocumentSection`: the Cupertino "Turn documents" inset group (the + group nested in the Session group) is now the same flat titled rows as on + Material, with the heading in the quiet section style. +- `ArtifactVisitList`: the grid/list switch's pinned bar was `StickyBar`, a + grouped-background band. It is now a local `PinnedHeaderSliver` on the + heading/page colour. +- The standalone `ArtifactGalleryPage` no longer forces the grouped + background on Cupertino. + +## Run detail chrome (P2-2) + +- No graph: `RunGraphPreview` now shows `runGraphMissing` as one muted line + (key `run-graph-preview-missing`). There is no 200px outlined box, and + nothing to tap or open. +- Wide (pane tabs at the top, pane at least 600 wide): + - `RunDetailWideChrome` (new, `run_detail_wide_chrome.dart`) puts the tabs + and the header (status kicker, Cancel/Retry, notices, decision banner) in + one floating row under the bar; + - the tabs lead, in line with the title pill, and take at most 60% of the + row; the header follows as a glass piece (key `run-detail-header`); + - before, this was title pill, then the status strip, then the tabs strip: + about 200px before content; + - narrower panes and phone pages keep the header strip under the bar, with + the tabs at the bottom. +- The Pipeline fact is dropped from the Summary when the run has a pipeline + name. That name is already in the bar's subtitle, and the title opens the + pipeline. `detailSummaryRows` itself is unchanged. +- Decision banner: the tinted, bordered card inside the grey header strip is + now a flat line of the strip. It keeps the teal glyph, the title over the + meta line, and Decide. The key `run-decision-banner` is kept. + +## Pipeline Summary (P2-3) + +- Facts: the five label/value rows are now a `FactsGrid` (key + `pipeline-summary-facts`, cells `pipeline-summary-`). + - The content hash takes a whole line (`wide`). It keeps the host font, + because the pipeline detail's no-monospace choice is untouched (P2-6 is + still a pending decision). + - Blank values are omitted instead of drawn empty. +- Schedules (`schedule_pipeline_list_body.dart`): + - The heading is a quiet `SectionHeading` ("Schedules (n)"), with Add as its + only trailing action: an icon button whose tooltip/semantics is "Add + schedule" (key `schedule-pipeline-add` kept). + - The inline Refresh is removed, with `scheduleRefreshKey`/`Label`. The + section reloads after every accepted mutation and has Retry on failure. + Note that the pipeline bar has no Refresh. The review assumed it did. + - The standing paragraph is gone. Its sentence is appended to the empty + state. +- Versions: + - `AppListRow` rows under a quiet "Versions" heading. The title is `vN`, the + time is the created date, and the line is `N stages`, plus `latest` when + it is the latest version. + - The shown version is the selected row (fill and selected semantics). This + replaces the check icon. + - "View latest vN" is a row too. + - Keys `pipeline-version-` and `pipeline-latest-version` are kept. + +## Tests + +- New: + - `test/features/runs/ui/run_detail_flat_bodies_test.dart`, both hosts: + - no `CupertinoListSection` on Summary or Timeline; + - the stage Session has Turn documents but no group (no nested groups); + - beside a list (`PageTabsEdge.top`, 720 wide) the header sits to the + right of the tabs and overlaps them vertically (one row); + - Cupertino heading scrim equals the page colour in light and dark. + - `test/features/pipelines/pipeline_summary_flat_test.dart`, both hosts: + - facts grid with short facts side by side; + - no Refresh, Add is an icon in the heading; + - no grouped section or `ListTile`; + - the version row is a selected `AppListRow`. +- `run_detail_summary_fields_test`: + - new single-fact case: the grid spans 900, the fact is at x=16 and left of + centre, and there is no group (the centred-card regression); + - the recorded-rows case now expects no Pipeline fact (it is in the bar). +- `run_detail_tabs_test` "missing graph": now expects one line on Summary, + with no preview, `RunGraphView` or frame, and under 60px tall. +- Updated for intentional changes: + - `run_timeline_row_test`: target and duration split; `AppListRow`, no + section; + - `pipelines_adaptive_test`: Cupertino version rows instead of + `CupertinoListTile`; + - `schedule_pipeline_section_test`: the empty text gained the note. + +## Evidence + +Captures are in `/tmp/r3-b-evidence/`. They were taken with the reviewer's +driver (`/tmp/r3-b-scripts/shoot.mjs`, a copy of +`/tmp/app-style-review-r2/shoot.mjs` pointing at this worktree's +`pipelines_wiring_probe_server.mjs`). The spec is +`/tmp/r3-b-scripts/mkspec.py`. + +- Runs: a web build of `tool/app_host_probe_entry.dart` over the wave2-e runs + fixture. +- Pipelines: the same build over `pipelines_wiring_probe_server`. +- Names: + - `{m,c}-{run1,run5,stage,pdetail}-{560,1200}-{light,dark}`; + - `{m,c}-{run1-timeline,stage-session,stage-artifacts}-560-{light,dark}`. + +There was no device run: Android and iOS are unverified. + +## Not done / notes + +- In the stage Session, the turn documents start at x=32 to 36: the list's + 16 padding plus the section's own 16. Material already rendered it this way + before this change, and it was left alone. +- Summary bodies are still uncapped on wide windows. That is batch K, which + is not in this scope. +- The 1200 Timeline/Session interactions were not captured. Only the 560 + tab clicks were scripted. diff --git a/app/test/features/pipelines/pipeline_summary_flat_test.dart b/app/test/features/pipelines/pipeline_summary_flat_test.dart new file mode 100644 index 00000000..f58a8383 --- /dev/null +++ b/app/test/features/pipelines/pipeline_summary_flat_test.dart @@ -0,0 +1,75 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:pipelines_app/features/pipelines/screen.dart'; +import 'package:pipelines_app/features/pipelines/widgets/pipeline_summary_view.dart'; +import 'package:pipelines_app/features/schedules/ui/pipeline/schedule_pipeline_wording.dart'; +import 'package:pipelines_app/ui/layout/app_list_row.dart'; + +import 'fixtures.dart'; + +/// The pipeline Summary is flat on both hosts: facts in the shared grid, +/// Schedules with Add as its heading's only action (no body Refresh), and +/// versions as the shared list row. +void main() { + for (final cupertino in [false, true]) { + testWidgets('pipeline Summary is a facts grid with flat sections ' + '(${cupertino ? 'cupertino' : 'material'})', (tester) async { + final gateway = FakeGateway((type, fields) { + return switch (type) { + 'list_pipelines' => pipelineListReply([ + pipelineSummary(id: 1, name: 'Alpha review', version: 3), + ]), + 'list_runs' => runListReply([]), + 'get_pipeline' => pipelineDetailReply( + pipelineDetail( + id: 1, + name: 'Alpha review', + version: 3, + latestVersion: 3, + versions: [versionSummary(2), versionSummary(3)], + ), + ), + 'list_schedules' => {'type': 'schedules', 'schedules': []}, + _ => errorReply('unexpected $type'), + }; + }); + tester.view.physicalSize = const Size(1100, 900); + tester.view.devicePixelRatio = 1; + addTearDown(tester.view.resetPhysicalSize); + addTearDown(tester.view.resetDevicePixelRatio); + final screen = PipelinesScreen(gateway: gateway); + await tester.pumpWidget( + cupertino + ? CupertinoApp(home: CupertinoPageScaffold(child: screen)) + : MaterialApp(home: screen), + ); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key('pipeline-row-1'))); + await tester.pumpAndSettle(); + + expect(find.byKey(pipelineSummaryFactsKey), findsOneWidget); + // Short facts share a line instead of one label/value row each. + final latest = tester.getRect( + find.byKey(const ValueKey('pipeline-summary-latest-version')), + ); + final versionCreated = tester.getRect( + find.byKey(const ValueKey('pipeline-summary-version-created')), + ); + expect(versionCreated.top, moreOrLessEquals(latest.top)); + expect(versionCreated.left, greaterThan(latest.right)); + + expect(find.text('Refresh'), findsNothing); + expect(find.text(scheduleAddLabel), findsNothing); + expect(find.byKey(scheduleAddKey), findsOneWidget); + expect(find.byType(CupertinoListSection), findsNothing); + expect(find.byType(ListTile), findsNothing); + final row = tester.widget( + find.byKey(const Key('pipeline-version-3')), + ); + expect(row.selected, isTrue); + expect(row.cupertino, cupertino); + expect(tester.takeException(), isNull); + }); + } +} diff --git a/app/test/features/pipelines/pipelines_adaptive_test.dart b/app/test/features/pipelines/pipelines_adaptive_test.dart index ddb8bfe6..8bf67e6d 100644 --- a/app/test/features/pipelines/pipelines_adaptive_test.dart +++ b/app/test/features/pipelines/pipelines_adaptive_test.dart @@ -141,7 +141,14 @@ void main() { ), findsOneWidget, ); - expect(find.byType(CupertinoListTile), findsWidgets); + // Versions are the shared row in its Cupertino form, flat on the page. + expect( + tester + .widget(find.byKey(const Key('pipeline-version-1'))) + .cupertino, + isTrue, + ); + expect(find.byType(CupertinoListSection), findsNothing); await tester.tap(find.byKey(const Key('pipeline-version-1'))); await tester.pumpAndSettle(); diff --git a/app/test/features/runs/ui/run_detail_flat_bodies_test.dart b/app/test/features/runs/ui/run_detail_flat_bodies_test.dart new file mode 100644 index 00000000..6bb26ec5 --- /dev/null +++ b/app/test/features/runs/ui/run_detail_flat_bodies_test.dart @@ -0,0 +1,91 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:pipelines_app/features/runs/data/runs_repository.dart'; +import 'package:pipelines_app/features/runs/ui/run_detail_tab.dart'; +import 'package:pipelines_app/features/runs/ui/run_detail_view.dart'; +import 'package:pipelines_app/features/runs/ui/run_detail_visit_sections.dart'; +import 'package:pipelines_app/features/runs/ui/runs_controller.dart'; +import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart'; +import 'package:pipelines_app/ui/layout/section_heading.dart'; + +import 'run_detail_graph_support.dart'; +import 'run_detail_visit_support.dart'; + +/// The run and stage detail bodies are flat on the page on both hosts: no +/// Cupertino inset group (so none nested in another), pinned headings on the +/// page colour, and beside a list one row of tabs and header. +void main() { + for (final platform in RunDetailTestPlatform.values) { + testWidgets('${platform.name} Summary and Timeline draw no grouped ' + 'card', (tester) async { + await pumpRunDetail(tester, platform); + expect(find.byType(CupertinoListSection), findsNothing); + await openRunDetailTab(tester, RunDetailTab.timeline); + expect(find.byType(CupertinoListSection), findsNothing); + expect(tester.takeException(), isNull); + }); + + testWidgets('${platform.name} the stage Session nests no group in a ' + 'group', (tester) async { + await openVisit(tester, platform); + await openVisitTab(tester, RunVisitSection.session); + expect(find.text('Turn documents'), findsOneWidget); + expect(find.byType(CupertinoListSection), findsNothing); + }); + + testWidgets('${platform.name} beside a list the tabs and the header ' + 'share one row', (tester) async { + tester.view.physicalSize = const Size(720, 900); + tester.view.devicePixelRatio = 1; + addTearDown(tester.view.reset); + final gateway = RunDetailFakeGateway(graphRunFixture()); + final controller = RunsController(RunsRepository(gateway)); + addTearDown(controller.dispose); + await controller.select(51); + final view = PageTabsEdge( + edge: FloatingBarEdge.top, + child: RunDetailView( + controller: controller, + gateway: gateway, + onBack: () {}, + ), + ); + await tester.pumpWidget( + platform == RunDetailTestPlatform.material + ? MaterialApp(home: Scaffold(body: view)) + : CupertinoApp(home: CupertinoPageScaffold(child: view)), + ); + await tester.pumpAndSettle(); + + final tabs = tester.getRect(find.byKey(const Key('run-detail-tabs'))); + final header = tester.getRect(find.byKey(const Key('run-detail-header'))); + // Side by side, not stacked: the header starts after the tabs and + // overlaps them vertically. + expect(header.left, greaterThanOrEqualTo(tabs.right - 12)); + expect(header.top, lessThan(tabs.bottom)); + expect(header.bottom, greaterThan(tabs.top)); + expect(tester.takeException(), isNull); + }); + } + + testWidgets('Cupertino pinned headings take the page colour', (tester) async { + for (final brightness in Brightness.values) { + late SectionHeadingStyle style; + late Color page; + await tester.pumpWidget( + CupertinoApp( + theme: CupertinoThemeData(brightness: brightness), + home: Builder( + builder: (context) { + style = SectionHeadingStyle.of(context); + page = CupertinoTheme.of(context).scaffoldBackgroundColor; + return const SizedBox.shrink(); + }, + ), + ), + ); + expect(style.background, page, reason: '$brightness'); + } + }); +} diff --git a/app/test/features/runs/ui/run_detail_summary_fields_test.dart b/app/test/features/runs/ui/run_detail_summary_fields_test.dart index e4888493..b1c1dc5a 100644 --- a/app/test/features/runs/ui/run_detail_summary_fields_test.dart +++ b/app/test/features/runs/ui/run_detail_summary_fields_test.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -132,10 +133,12 @@ void main() { size: const Size(900, 1600), ); - for (final label in recordedLabels) { + // The bar's subtitle names the pipeline, so no Pipeline fact repeats it. + for (final label in recordedLabels.where((l) => l != 'Pipeline')) { expect(find.text(label), findsOneWidget, reason: label); } - expect(find.text('id 3 · v2'), findsOneWidget); + expect(find.text('Pipeline'), findsNothing); + expect(find.text('id 3 · v2'), findsNothing); expect(find.text('review'), findsOneWidget); expect(find.text('/srv/workspaces/run-51'), findsOneWidget); expect(find.text('abc123def456'), findsOneWidget); @@ -199,6 +202,28 @@ void main() { expect(hash.width, greaterThan(300)); }); + testWidgets('${platform.name} a single fact starts at the leading edge, ' + 'with no grouped card', (tester) async { + await pumpRunDetail( + tester, + platform, + run: absentRunFixture()..['current_stage'] = 'review', + size: const Size(900, 1600), + ); + final grid = tester.getRect( + find.byKey(const Key('run-detail-summary-facts')), + ); + final stage = tester.getRect( + find.byKey(const ValueKey('run-detail-summary-stage')), + ); + // The grid spans the Summary, and its one fact is at the start of the + // line rather than a half-width block centred on the page. + expect(grid.width, moreOrLessEquals(900)); + expect(stage.left, moreOrLessEquals(16)); + expect(stage.center.dx, lessThan(450)); + expect(find.byType(CupertinoListSection), findsNothing); + }); + testWidgets('${platform.name} summary sections state their exact empty ' 'wording', (tester) async { await pumpRunDetail( diff --git a/app/test/features/runs/ui/run_detail_tabs_test.dart b/app/test/features/runs/ui/run_detail_tabs_test.dart index 454840e5..ba1517a3 100644 --- a/app/test/features/runs/ui/run_detail_tabs_test.dart +++ b/app/test/features/runs/ui/run_detail_tabs_test.dart @@ -121,10 +121,23 @@ void main() { tester, ) async { await pumpRunDetail(tester, platform, run: graphRunFixture(graph: false)); - await openRunDetailTab(tester, RunDetailTab.graph); + await openRunDetailTab(tester, RunDetailTab.summary); + // One muted line on the Summary: no framed, tappable empty preview. expect(find.text(runGraphMissing), findsOneWidget); + expect(find.byKey(runGraphPreviewMissingKey), findsOneWidget); + expect(find.byKey(runGraphPreviewKey), findsNothing); + expect(find.byType(RunGraphView), findsNothing); expect(find.byType(InteractiveViewer), findsNothing); + final line = tester.getSize(find.byKey(runGraphPreviewMissingKey)); + expect(line.height, lessThan(60)); + expect( + find.descendant( + of: find.byKey(runGraphPreviewMissingKey), + matching: find.byType(DecoratedBox), + ), + findsNothing, + ); }); testWidgets('${platform.name} Graph stays bounded at 320 with 2x text', ( diff --git a/app/test/features/runs/ui/run_timeline_row_test.dart b/app/test/features/runs/ui/run_timeline_row_test.dart index 3f949b28..c1159bbe 100644 --- a/app/test/features/runs/ui/run_timeline_row_test.dart +++ b/app/test/features/runs/ui/run_timeline_row_test.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/runs/ui/run_detail_content.dart'; import 'package:pipelines_app/features/runs/ui/run_detail_timeline.dart'; +import 'package:pipelines_app/ui/layout/app_list_row.dart'; import 'package:pipelines_app/ui/status/run_status_icon.dart'; final _steps = [ @@ -52,8 +53,13 @@ void main() { expect(find.text('success'), findsOneWidget); expect(find.text('error'), findsOneWidget); - expect(find.text('→ build · 2m 5s'), findsOneWidget); + // The target is the line; the duration is the row's time. + expect(find.text('→ build'), findsOneWidget); + expect(find.text('2m 5s'), findsOneWidget); expect(find.text('→ #failure'), findsOneWidget); + // The shared flat row, with no grouped card on either host. + expect(find.byType(AppListRow), findsNWidgets(3)); + expect(find.byType(CupertinoListSection), findsNothing); }); } diff --git a/app/test/features/schedules/ui/pipeline/schedule_pipeline_section_test.dart b/app/test/features/schedules/ui/pipeline/schedule_pipeline_section_test.dart index b6cad9b2..adb8fdf6 100644 --- a/app/test/features/schedules/ui/pipeline/schedule_pipeline_section_test.dart +++ b/app/test/features/schedules/ui/pipeline/schedule_pipeline_section_test.dart @@ -112,10 +112,7 @@ void main() { await pumpScheduleSection(tester, gateway: gateway, version: 3); expect(find.text('Schedules (0)'), findsOneWidget); - expect( - find.text('No schedules yet. Add one for each topic or recurring task.'), - findsOneWidget, - ); + expect(find.textContaining(scheduleSectionEmpty), findsOneWidget); await tester.tap(find.byKey(scheduleAddKey)); await tester.pumpAndSettle(); @@ -329,10 +326,7 @@ void main() { expect(gateway.callsOf('delete_schedule'), hasLength(1)); expect(find.text('Research batteries'), findsNothing); - expect( - find.text('No schedules yet. Add one for each topic or recurring task.'), - findsOneWidget, - ); + expect(find.textContaining(scheduleSectionEmpty), findsOneWidget); expect(gateway.calls.map((call) => call.type), [ 'list_schedules', 'delete_schedule',