From 25b9118ee9cf3b7ce5dfb073aa5a7045f46685c1 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Fri, 23 Oct 2026 18:31:26 +0100 Subject: [PATCH 1/2] feat(app): a stage visit's sections are bottom tabs, its input and output read as values, and the page bar holds the only Back --- .../runs/ui/run_detail_tab_bodies.dart | 18 ++--- app/lib/features/runs/ui/run_detail_tabs.dart | 16 +++- .../features/runs/ui/run_detail_visit.dart | 73 +++++-------------- .../runs/ui/run_detail_visit_sections.dart | 32 +++++--- .../ui/run_detail_visit_sections_test.dart | 20 ++++- 5 files changed, 83 insertions(+), 76 deletions(-) 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 ca94f650..fe30c67a 100644 --- a/app/lib/features/runs/ui/run_detail_tab_bodies.dart +++ b/app/lib/features/runs/ui/run_detail_tab_bodies.dart @@ -2,7 +2,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../core/api_gateway.dart'; -import 'run_detail_content.dart'; import 'run_detail_summary_fields.dart'; import 'run_detail_visit_facts.dart'; import 'run_field_body.dart'; @@ -117,18 +116,19 @@ Widget runDetailFieldTab({ required String empty, required bool cupertino, }) { - final text = detailEmpty(value) ? empty : detailJson(value); + // The recorded fields by name, as values, never raw JSON. + final body = RunFieldBody( + value: value, + empty: empty, + cupertino: cupertino, + textBuilder: cupertino ? _CupertinoSelectableText.new : null, + ); if (cupertino) { return ListView( key: Key('run-detail-tab-body-$tabKey'), children: [ CupertinoListSection.insetGrouped( - children: [ - Padding( - padding: const EdgeInsets.all(16), - child: _CupertinoSelectableText(text), - ), - ], + children: [Padding(padding: const EdgeInsets.all(16), child: body)], ), ], ); @@ -136,7 +136,7 @@ Widget runDetailFieldTab({ return ListView( key: Key('run-detail-tab-body-$tabKey'), padding: const EdgeInsets.all(16), - children: [SelectableText(text)], + children: [body], ); } diff --git a/app/lib/features/runs/ui/run_detail_tabs.dart b/app/lib/features/runs/ui/run_detail_tabs.dart index 4f5e2f68..0cda33a3 100644 --- a/app/lib/features/runs/ui/run_detail_tabs.dart +++ b/app/lib/features/runs/ui/run_detail_tabs.dart @@ -302,12 +302,24 @@ class _RunDetailTabsState extends State { final title = detailTitle(run); if (cupertino) { return CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar(middle: Text(title)), + navigationBar: CupertinoNavigationBar( + leading: CupertinoNavigationBarBackButton( + key: const Key('run-visit-back'), + onPressed: () => Navigator.of(pageContext).pop(), + ), + middle: Text(title), + ), child: SafeArea(child: pane), ); } return Scaffold( - appBar: AppBar(title: Text(title)), + appBar: AppBar( + leading: BackButton( + key: const Key('run-visit-back'), + onPressed: () => Navigator.of(pageContext).pop(), + ), + title: Text(title), + ), body: SafeArea(top: false, child: pane), ); }, diff --git a/app/lib/features/runs/ui/run_detail_visit.dart b/app/lib/features/runs/ui/run_detail_visit.dart index 447fdfee..289924ec 100644 --- a/app/lib/features/runs/ui/run_detail_visit.dart +++ b/app/lib/features/runs/ui/run_detail_visit.dart @@ -74,7 +74,7 @@ class _RunVisitPaneState extends State { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Flexible( - flex: 3, + flex: 2, fit: FlexFit.loose, child: SingleChildScrollView( key: const Key('run-visit-facts'), @@ -100,12 +100,8 @@ class _RunVisitPaneState extends State { ), ), ), - RunVisitSectionStrip( - selected: _section, - onSelected: (section) => setState(() => _section = section), - ), Expanded( - flex: 2, + flex: 5, child: runVisitSectionBody( section: _section, run: widget.run, @@ -119,58 +115,27 @@ class _RunVisitPaneState extends State { cupertino: widget.cupertino, ), ), + // The sections are tabs at the bottom, under what they show. + SafeArea( + top: false, + child: RunVisitSectionStrip( + selected: _section, + onSelected: (section) => setState(() => _section = section), + ), + ), ], ); } - Widget _bar(_VisitStyle style) { - final close = widget.cupertino - ? CupertinoButton( - key: const Key('run-visit-back'), - padding: EdgeInsets.zero, - onPressed: widget.onClose, - child: const Row( - mainAxisSize: MainAxisSize.min, - children: [ - Icon(CupertinoIcons.back), - SizedBox(width: 4), - Flexible(child: Text('Back to timeline')), - ], - ), - ) - : TextButton.icon( - key: const Key('run-visit-back'), - onPressed: widget.onClose, - icon: const Icon(Icons.arrow_back), - label: const Text('Back to timeline'), - ); - return Padding( - padding: const EdgeInsets.symmetric(vertical: 4), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // The close and change actions wrap instead of overflowing when the - // pane is narrow or the text is scaled. - Wrap( - spacing: 8, - runSpacing: 4, - crossAxisAlignment: WrapCrossAlignment.center, - children: [close], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.visit.title, - key: const Key('run-visit-title'), - style: style.heading, - ), - ], - ), - ], - ), - ); - } + /// The visit's name; Back is the page bar's. + Widget _bar(_VisitStyle style) => Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Text( + widget.visit.title, + key: const Key('run-visit-title'), + style: style.heading, + ), + ); } class _FactRow extends StatelessWidget { diff --git a/app/lib/features/runs/ui/run_detail_visit_sections.dart b/app/lib/features/runs/ui/run_detail_visit_sections.dart index 59d77994..15d692af 100644 --- a/app/lib/features/runs/ui/run_detail_visit_sections.dart +++ b/app/lib/features/runs/ui/run_detail_visit_sections.dart @@ -5,7 +5,6 @@ import '../../../core/api_gateway.dart'; import '../../../ui/adaptive/host.dart'; import '../../changes/changes.dart'; import 'run_detail_tab_bodies.dart'; -import 'run_detail_tab_strip.dart'; import 'run_detail_visit_artifacts.dart'; import 'run_detail_visit_definition.dart'; import 'run_detail_visit_facts.dart'; @@ -43,12 +42,22 @@ class RunVisitSectionStrip extends StatelessWidget { @override Widget build(BuildContext context) { final cupertino = usesCupertinoHost(context); - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: ScrollWhenOverflowing( - child: KeyedSubtree( - key: const Key('run-visit-tabs'), - child: cupertino ? _cupertinoControl() : _materialControl(), + // A full-width bar under the section, as the run's own tabs on a phone. + final divider = cupertino + ? CupertinoColors.separator.resolveFrom(context) + : Theme.of(context).colorScheme.outlineVariant; + return DecoratedBox( + decoration: BoxDecoration( + border: Border(top: BorderSide(color: divider, width: 0.5)), + ), + child: Padding( + padding: const EdgeInsets.fromLTRB(8, 8, 8, 8), + child: SizedBox( + width: double.infinity, + child: KeyedSubtree( + key: const Key('run-visit-tabs'), + child: cupertino ? _cupertinoControl() : _materialControl(), + ), ), ), ); @@ -61,6 +70,7 @@ class RunVisitSectionStrip extends StatelessWidget { ], selected: {selected}, showSelectedIcon: false, + expandedInsets: EdgeInsets.zero, onSelectionChanged: (selection) => onSelected(selection.single), ); @@ -73,7 +83,7 @@ class RunVisitSectionStrip extends StatelessWidget { children: { for (final section in RunVisitSection.values) section: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), + padding: const EdgeInsets.symmetric(horizontal: 2), child: _label(section), ), }, @@ -81,7 +91,11 @@ class RunVisitSectionStrip extends StatelessWidget { Widget _label(RunVisitSection section) => KeyedSubtree( key: ValueKey('run-visit-tab-${section.name}'), - child: Text(section.label, maxLines: 1, softWrap: false), + // Six sections share the width; a long label shrinks rather than clips. + child: FittedBox( + fit: BoxFit.scaleDown, + child: Text(section.label, maxLines: 1, softWrap: false), + ), ); } diff --git a/app/test/features/runs/ui/run_detail_visit_sections_test.dart b/app/test/features/runs/ui/run_detail_visit_sections_test.dart index 9c3abe0c..920627f1 100644 --- a/app/test/features/runs/ui/run_detail_visit_sections_test.dart +++ b/app/test/features/runs/ui/run_detail_visit_sections_test.dart @@ -11,13 +11,29 @@ import 'run_detail_visit_support.dart'; void main() { for (final platform in RunDetailTestPlatform.values) { + testWidgets('${platform.name} stage tabs sit at the bottom with one Back', ( + tester, + ) async { + await openVisit(tester, platform, size: const Size(390, 844)); + final tabs = tester.getRect(find.byKey(const Key('run-visit-tabs'))); + expect(tabs.bottom, greaterThan(844 - 90)); + expect(find.text('Back to timeline'), findsNothing); + expect(find.text('Back'), findsNothing); + // The page bar's own Back is the only one. + expect(find.byKey(const Key('run-visit-back')), findsOneWidget); + }); + testWidgets('${platform.name} tabs show recorded values and exact empty ' 'wording', (tester) async { await openVisit(tester, platform); - expect(find.textContaining('"prompt": "Ship it."'), findsOneWidget); + // Each field by name with its value, never raw JSON. + expect(find.text('prompt'), findsOneWidget); + expect(find.text('Ship it.'), findsOneWidget); + expect(find.textContaining('"prompt"'), findsNothing); await openVisitTab(tester, RunVisitSection.output); - expect(find.textContaining('"result": "ok"'), findsOneWidget); + expect(find.text('result'), findsOneWidget); + expect(find.text('ok'), findsOneWidget); await openVisitTab(tester, RunVisitSection.artifacts); expect(find.text('plan.csv'), findsOneWidget); From e109741ef8f35dc7ba3a7ae3e7e3158120b6994b Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Fri, 23 Oct 2026 18:32:04 +0100 Subject: [PATCH 2/2] feat(app): run and stage tabs show an icon above each name --- app/lib/features/runs/ui/run_detail_tab.dart | 27 +++++++++---- .../runs/ui/run_detail_tab_strip.dart | 14 ++++++- .../runs/ui/run_detail_visit_sections.dart | 39 +++++++++++++++---- .../ui/run_detail_visit_sections_test.dart | 16 ++++++++ 4 files changed, 78 insertions(+), 18 deletions(-) diff --git a/app/lib/features/runs/ui/run_detail_tab.dart b/app/lib/features/runs/ui/run_detail_tab.dart index 40e1bf00..339a7cad 100644 --- a/app/lib/features/runs/ui/run_detail_tab.dart +++ b/app/lib/features/runs/ui/run_detail_tab.dart @@ -1,3 +1,6 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + /// The run-detail sections in the web's order: Summary first, the run Graph /// second, then the recorded Input, Output and Timeline. /// @@ -5,15 +8,23 @@ /// are the same words. `renderedRunDetailTabs` decides which keys the strip /// draws, so Input and Output stay addressable without being tabs. enum RunDetailTab { - summary('Summary'), - graph('Graph'), - input('Input'), - output('Output'), - timeline('Timeline'), - artifacts('Artifacts'), - changes('Changes'); + summary('Summary', Icons.summarize_outlined, CupertinoIcons.doc_text), + graph('Graph', Icons.account_tree_outlined, CupertinoIcons.arrow_branch), + input('Input', Icons.input, CupertinoIcons.arrow_down_doc), + output('Output', Icons.output, CupertinoIcons.arrow_up_doc), + timeline('Timeline', Icons.timeline, CupertinoIcons.list_bullet), + artifacts('Artifacts', Icons.inventory_2_outlined, CupertinoIcons.cube_box), + changes( + 'Changes', + Icons.difference_outlined, + CupertinoIcons.arrow_right_arrow_left, + ); - const RunDetailTab(this.label); + const RunDetailTab(this.label, this.icon, this.cupertinoIcon); final String label; + + /// The tab's glyph, so a tab is recognisable at a glance. + final IconData icon; + final IconData cupertinoIcon; } diff --git a/app/lib/features/runs/ui/run_detail_tab_strip.dart b/app/lib/features/runs/ui/run_detail_tab_strip.dart index 2324b456..af24f786 100644 --- a/app/lib/features/runs/ui/run_detail_tab_strip.dart +++ b/app/lib/features/runs/ui/run_detail_tab_strip.dart @@ -136,11 +136,21 @@ class _RunDetailTabStripState extends State { key: _labels[tab], child: KeyedSubtree( key: ValueKey('run-detail-tab-${tab.name}'), - // A full-width bar shrinks a long label rather than overflowing it. + // A full-width bar shrinks a long label rather than overflowing it, + // and shows the tab's glyph above its name. child: widget.bottom ? FittedBox( fit: BoxFit.scaleDown, - child: Text(tab.label, maxLines: 1, softWrap: false), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + usesCupertinoHost(context) ? tab.cupertinoIcon : tab.icon, + size: 18, + ), + Text(tab.label, maxLines: 1, softWrap: false), + ], + ), ) : Text(tab.label, maxLines: 1, softWrap: false), ), diff --git a/app/lib/features/runs/ui/run_detail_visit_sections.dart b/app/lib/features/runs/ui/run_detail_visit_sections.dart index 15d692af..69f31a90 100644 --- a/app/lib/features/runs/ui/run_detail_visit_sections.dart +++ b/app/lib/features/runs/ui/run_detail_visit_sections.dart @@ -14,16 +14,28 @@ import 'run_detail_visit_session.dart'; /// client follows: the turn's Input and Output, its Artifacts, the files this /// visit changed, its Session and the authored Definition. enum RunVisitSection { - input('Input'), - output('Output'), - artifacts('Artifacts'), - changes('Changes'), - session('Session'), - definition('Definition'); + input('Input', Icons.input, CupertinoIcons.arrow_down_doc), + output('Output', Icons.output, CupertinoIcons.arrow_up_doc), + artifacts('Artifacts', Icons.inventory_2_outlined, CupertinoIcons.cube_box), + changes( + 'Changes', + Icons.difference_outlined, + CupertinoIcons.arrow_right_arrow_left, + ), + session('Session', Icons.forum_outlined, CupertinoIcons.chat_bubble_2), + definition( + 'Definition', + Icons.description_outlined, + CupertinoIcons.doc_plaintext, + ); - const RunVisitSection(this.label); + const RunVisitSection(this.label, this.icon, this.cupertinoIcon); final String label; + + /// The section's glyph, so a tab is recognisable at a glance. + final IconData icon; + final IconData cupertinoIcon; } /// The visit pane's native tab strip: a Material segmented button or a Cupertino @@ -94,7 +106,18 @@ class RunVisitSectionStrip extends StatelessWidget { // Six sections share the width; a long label shrinks rather than clips. child: FittedBox( fit: BoxFit.scaleDown, - child: Text(section.label, maxLines: 1, softWrap: false), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Builder( + builder: (context) => Icon( + usesCupertinoHost(context) ? section.cupertinoIcon : section.icon, + size: 18, + ), + ), + Text(section.label, maxLines: 1, softWrap: false), + ], + ), ), ); } diff --git a/app/test/features/runs/ui/run_detail_visit_sections_test.dart b/app/test/features/runs/ui/run_detail_visit_sections_test.dart index 920627f1..1ba8fa28 100644 --- a/app/test/features/runs/ui/run_detail_visit_sections_test.dart +++ b/app/test/features/runs/ui/run_detail_visit_sections_test.dart @@ -21,6 +21,22 @@ void main() { expect(find.text('Back'), findsNothing); // The page bar's own Back is the only one. expect(find.byKey(const Key('run-visit-back')), findsOneWidget); + // Every tab shows its glyph above its name. + for (final section in RunVisitSection.values) { + final tab = find.byKey(ValueKey('run-visit-tab-${section.name}')); + expect( + find.descendant( + of: tab, + matching: find.byIcon( + platform == RunDetailTestPlatform.cupertino + ? section.cupertinoIcon + : section.icon, + ), + ), + findsOneWidget, + reason: section.name, + ); + } }); testWidgets('${platform.name} tabs show recorded values and exact empty '