Files
pipelines/app/lib/features/runs/ui/run_detail_top_tabs.dart
T
alan ebe79ebed0 App: findings ledger tab, retry extra visits and exhaustion decisions
Run detail gains a Findings tab (open-count badge) listing the server's
findings ledger with status and minimum-severity filters and expandable
event history; visit grants show as an Extra visits summary fact. The
resume retry prompt can grant 1-5 extra visits to the exhausted stage or a
chosen graph stage (never sent on restart), suggested when the run failed
on a visit limit. A loop-exhaustion decision waiting on a model stage is
now decidable from its recorded options, with readable labels, targets and
the visit count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 12:45:51 +00:00

90 lines
3.1 KiB
Dart

import 'package:flutter/material.dart';
import 'run_detail_tab.dart';
import 'run_detail_tab_strip.dart';
/// The run detail's tabs on a wide layout: a Material [SegmentedButton] of
/// icon-and-label segments under the run header, at the top of the detail
/// where the eye already is, with labels at the button text size.
///
/// The segments keep their order and positions across runs: Artifacts is
/// always one, disabled with a `0` count when the run recorded none. Keys
/// match the phone bar's: the whole row `run-detail-tabs`, each label
/// `run-detail-tab-<name>`.
class RunDetailTopTabs extends StatelessWidget {
const RunDetailTopTabs({
super.key,
required this.tabs,
required this.selected,
required this.onSelected,
this.artifactCount,
this.openFindingCount,
this.disabled = const {},
this.disabledReasons = const {},
});
final List<RunDetailTab> tabs;
final RunDetailTab selected;
final ValueChanged<RunDetailTab> onSelected;
final int? artifactCount;
final int? openFindingCount;
final Set<RunDetailTab> disabled;
/// Why a disabled tab cannot open, as its tooltip.
final Map<RunDetailTab, String> disabledReasons;
@override
Widget build(BuildContext context) {
final count = artifactCount;
final scheme = Theme.of(context).colorScheme;
return Align(
key: const Key('run-detail-tabs'),
alignment: AlignmentDirectional.centerStart,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: SegmentedButton<RunDetailTab>(
showSelectedIcon: false,
// On the frosted strip the unselected segments take the surface,
// so the selected one's tonal fill stands out from the glass.
style: ButtonStyle(
backgroundColor: WidgetStateProperty.resolveWith(
(states) => states.contains(WidgetState.selected)
? scheme.secondaryContainer
: scheme.surface,
),
),
segments: [
for (final tab in tabs)
ButtonSegment<RunDetailTab>(
value: tab,
enabled: !disabled.contains(tab),
tooltip: disabled.contains(tab) ? disabledReasons[tab] : null,
icon: Icon(tab.icon),
label: Row(
key: ValueKey('run-detail-tab-${tab.name}'),
mainAxisSize: MainAxisSize.min,
children: [
Text(tab.label),
if (tab == RunDetailTab.artifacts && count != null) ...[
const SizedBox(width: 6),
RunArtifactsCount(count: count),
],
if (tab == RunDetailTab.findings &&
(openFindingCount ?? 0) > 0) ...[
const SizedBox(width: 6),
RunOpenFindingsCount(count: openFindingCount!),
],
],
),
),
],
selected: {selected},
onSelectionChanged: (value) {
if (value.isNotEmpty) onSelected(value.first);
},
),
),
);
}
}