Files
pipelines/app/lib/features/runs/ui/run_detail_top_tabs.dart
T
alan a6db4ba20e App: run tabs under the header on wide layouts, stable Artifacts tab, spelled-out pipeline status, shared list selection, code block header and edge fades
- Run detail: on a wide window (>= 840, pane >= 600) the tabs are Material
  segments under the run header; phones keep the floating bottom bar.
  Artifacts is always a tab, badged with its count and disabled with 0 (its
  tooltip says why), so Changes never moves.
- Pipelines list: 'Failed · last run 19 Oct' beside the status dot; facts on
  the next line; compact rows keep 'Failed · 19 Oct'.
- Settings: Disconnect is outlined beside a tonal Reconnect.
- Lists: one selection style (tonal fill plus one leading accent bar) for
  runs, pipelines and chats; chat's border, fill and pointer removed.
- Transcript: overflowing blocks fade at the edge with a chevron instead of
  a 'Scroll horizontally' line (semantics hint kept); code blocks get a
  header strip with language and Copy; lighter light-mode code fill.
- Runs list: rows under a day heading show only the time of day.
- Artifact search reveal re-centres once the lazy list's extent settles.

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

83 lines
2.8 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.disabled = const {},
this.disabledReasons = const {},
});
final List<RunDetailTab> tabs;
final RunDetailTab selected;
final ValueChanged<RunDetailTab> onSelected;
final int? artifactCount;
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),
],
],
),
),
],
selected: {selected},
onSelectionChanged: (value) {
if (value.isNotEmpty) onSelected(value.first);
},
),
),
);
}
}