54 lines
1.7 KiB
Dart
54 lines
1.7 KiB
Dart
import 'package:flutter/widgets.dart';
|
|
|
|
import '../../../ui/adaptive/floating_bar_layout.dart';
|
|
import '../../../ui/adaptive/floating_destination_bar.dart';
|
|
import 'pipeline_controls.dart';
|
|
import 'pipeline_detail_tab.dart';
|
|
|
|
export 'pipeline_detail_tab.dart';
|
|
|
|
/// The pipeline detail's tabs: the app's floating glass tab bar at the bottom,
|
|
/// full width on a phone page; beside a list, sized to its tabs at the bottom
|
|
/// of the detail pane (the shell's tab bar stays over the list pane).
|
|
///
|
|
/// Float it over the tab body with `FloatingBarOverlay`. The whole bar is
|
|
/// keyed `pipeline-detail-tabs`, each tab `pipeline-detail-tab-<name>`.
|
|
class PipelineDetailTabs extends StatelessWidget {
|
|
const PipelineDetailTabs({
|
|
super.key,
|
|
required this.selected,
|
|
required this.onSelected,
|
|
this.edge = FloatingBarEdge.bottom,
|
|
});
|
|
|
|
final PipelineDetailTab selected;
|
|
final ValueChanged<PipelineDetailTab> onSelected;
|
|
|
|
/// Where the bar floats: the bottom of a page, or the top of a pane beside
|
|
/// a list (see `PageTabsEdge`).
|
|
final FloatingBarEdge edge;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final cupertino = useCupertinoControls(context);
|
|
const tabs = PipelineDetailTab.values;
|
|
return KeyedSubtree(
|
|
key: const Key('pipeline-detail-tabs'),
|
|
child: FloatingDestinationBar(
|
|
cupertino: cupertino,
|
|
currentIndex: tabs.indexOf(selected),
|
|
edge: edge,
|
|
onTap: (value) => onSelected(tabs[value]),
|
|
items: [
|
|
for (final tab in tabs)
|
|
FloatingDestinationItem(
|
|
key: ValueKey('pipeline-detail-tab-${tab.name}'),
|
|
icon: Icon(cupertino ? tab.cupertinoIcon : tab.icon),
|
|
label: tab.label,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|