feat(app): run and stage tabs show an icon above each name

This commit is contained in:
2026-10-23 18:32:04 +01:00
parent 25b9118ee9
commit e109741ef8
4 changed files with 78 additions and 18 deletions
+19 -8
View File
@@ -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;
}
@@ -136,11 +136,21 @@ class _RunDetailTabStripState extends State<RunDetailTabStrip> {
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),
),
@@ -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),
],
),
),
);
}
@@ -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 '