963adec122
One floating frosted tab bar (host NavigationBar / CupertinoTabBar in the shared GlassPill) replaces the NavigationRail, the Cupertino sidebar and the run detail, stage page and pipeline detail tab strips. Below 600px it spans the width minus 16px margins; wider it is sized to its tabs at the right edge. Content keeps the full width, scrolls behind the bar and learns its height as bottom media padding; lists pad their end clear of it and FABs sit above it. The bar now sizes itself from its own constraints instead of the screen size, which fixes the widget_test failure where a MediaQuery without a size gave it negative width constraints.
62 lines
2.1 KiB
Dart
62 lines
2.1 KiB
Dart
import 'package:flutter/widgets.dart';
|
|
|
|
import '../../../ui/adaptive/floating_destination_bar.dart';
|
|
import '../../../ui/adaptive/host.dart';
|
|
import 'run_detail_tab.dart';
|
|
|
|
/// The tabs the strip renders, in the web's order: Summary first so it is the
|
|
/// default, then the Timeline, the run's Artifacts and its Changes. Input and
|
|
/// Output are collapsible Summary sections now, so their stable enum keys stay
|
|
/// available for old routes but they are not separate tabs. The graph is a
|
|
/// preview on Summary that opens full screen, so it has no tab of its own.
|
|
const List<RunDetailTab> renderedRunDetailTabs = [
|
|
RunDetailTab.summary,
|
|
RunDetailTab.timeline,
|
|
RunDetailTab.artifacts,
|
|
RunDetailTab.changes,
|
|
];
|
|
|
|
/// The run detail's tabs: the app's floating glass tab bar, full width on a
|
|
/// phone and sized to its tabs at the right edge of a wide pane.
|
|
///
|
|
/// Float it over the tab body with `FloatingBarOverlay`; every tab is always
|
|
/// visible, so a tab selected by the Graph is shown selected without
|
|
/// scrolling. The whole bar is keyed `run-detail-tabs`, each tab
|
|
/// `run-detail-tab-<name>`.
|
|
class RunDetailTabStrip extends StatelessWidget {
|
|
const RunDetailTabStrip({
|
|
super.key,
|
|
required this.selected,
|
|
required this.onSelected,
|
|
this.tabs = renderedRunDetailTabs,
|
|
});
|
|
|
|
final RunDetailTab selected;
|
|
final ValueChanged<RunDetailTab> onSelected;
|
|
|
|
/// The tabs this run offers, in [renderedRunDetailTabs] order.
|
|
final List<RunDetailTab> tabs;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final cupertino = usesCupertinoHost(context);
|
|
final index = tabs.indexOf(selected);
|
|
return KeyedSubtree(
|
|
key: const Key('run-detail-tabs'),
|
|
child: FloatingDestinationBar(
|
|
cupertino: cupertino,
|
|
currentIndex: index < 0 ? 0 : index,
|
|
onTap: (value) => onSelected(tabs[value]),
|
|
items: [
|
|
for (final tab in tabs)
|
|
FloatingDestinationItem(
|
|
key: ValueKey('run-detail-tab-${tab.name}'),
|
|
icon: Icon(cupertino ? tab.cupertinoIcon : tab.icon),
|
|
label: tab.label,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|