Improve recorded visit heading hierarchy

This commit is contained in:
2026-10-25 21:48:38 +00:00
parent 96178570e5
commit ca6a05167b
2 changed files with 69 additions and 12 deletions
+33 -9
View File
@@ -132,15 +132,35 @@ class _RunVisitPaneState extends State<RunVisitPane> {
);
}
/// 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,
),
);
/// Keep stage identity visually distinct from the visit/run coordinates.
/// Back is the page bar's; this heading is the selected recorded stage.
Widget _bar(_VisitStyle style) {
final runId = '${widget.run['id'] ?? ''}'.trim();
return Padding(
padding: const EdgeInsetsDirectional.fromSTEB(0, 8, 0, 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.visit.stage,
key: const Key('run-visit-title'),
style: style.stageTitle,
softWrap: true,
),
const SizedBox(height: 4),
Wrap(
spacing: 12,
runSpacing: 4,
children: [
if (widget.visit.sequence != null)
Text('Visit ${widget.visit.sequence}', style: style.muted),
if (runId.isNotEmpty) Text('Run $runId', style: style.muted),
],
),
],
),
);
}
}
/// The visit's facts several to a line: status and outcome as coloured
@@ -217,6 +237,7 @@ class _VisitStyle {
required this.value,
required this.muted,
required this.heading,
required this.stageTitle,
});
factory _VisitStyle.of(BuildContext context) {
@@ -227,6 +248,7 @@ class _VisitStyle {
value: theme.textTheme.textStyle,
muted: theme.textTheme.textStyle.copyWith(color: secondary),
heading: theme.textTheme.navTitleTextStyle,
stageTitle: theme.textTheme.navLargeTitleTextStyle,
);
}
final theme = Theme.of(context);
@@ -236,10 +258,12 @@ class _VisitStyle {
color: theme.colorScheme.onSurfaceVariant,
),
heading: theme.textTheme.titleSmall ?? const TextStyle(),
stageTitle: theme.textTheme.headlineSmall ?? const TextStyle(),
);
}
final TextStyle value;
final TextStyle muted;
final TextStyle heading;
final TextStyle stageTitle;
}
@@ -16,7 +16,9 @@ void main() {
await openVisit(tester, platform);
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expect(find.text('plan · visit 1'), findsOneWidget);
expect(find.text('plan'), findsOneWidget);
expect(find.text('Visit 1'), findsOneWidget);
expect(find.text('Run 77'), findsOneWidget);
// Each fact as its label over its value; several share a line.
for (final (label, value) in [
('Status', 'completed'),
@@ -34,8 +36,16 @@ void main() {
expect(find.text('Verdict'), findsOneWidget);
expect(find.text('Diagnostic'), findsOneWidget);
// The title and its facts share one leading edge.
final title = tester.getTopLeft(find.text('plan · visit 1')).dx;
// Stage identity is a distinct, prominent heading; coordinates are
// subordinate and the facts remain aligned with the heading.
final titleFinder = find.byKey(const Key('run-visit-title'));
final title = tester.getTopLeft(titleFinder).dx;
final titleStyle = tester.widget<Text>(titleFinder).style!;
expect(titleStyle.fontSize!, greaterThan(18));
expect(
tester.getTopLeft(find.text('Visit 1')).dy,
greaterThan(tester.getTopLeft(titleFinder).dy),
);
expect(
tester.getTopLeft(find.byKey(const Key('run-visit-facts-grid'))).dx,
title,
@@ -98,6 +108,29 @@ void main() {
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expect(tester.takeException(), isNull);
});
testWidgets('${platform.name} long stage identity wraps at 2x', (
tester,
) async {
final run = visitRunFixture();
firstVisitStep(run)['stage'] =
'review-generated-release-artifacts-and-verify-evidence';
await openVisit(
tester,
platform,
run: run,
size: const Size(320, 568),
scale: 2,
);
expect(
find.text('review-generated-release-artifacts-and-verify-evidence'),
findsOneWidget,
);
expect(find.text('Visit 1'), findsOneWidget);
expect(find.text('Run 77'), findsOneWidget);
expect(tester.takeException(), isNull);
});
}
testWidgets('session export with no configured endpoint states the hint', (