fix(app): float content behind top bars and give each wide pane its own bar row
- Top-bar clearance helpers (withTopBarClearance, withBarClearance, SliverTopBarClearance, BelowTopBar, TopBarNotices); shell, DetailPane and the runs/pipelines/templates/artifacts/stage definition/filter/usage pages drop their top SafeArea and pad their own lists, pinned headers pin at the inset. - Wide windows: the shell bar narrows to the list pane (ShellPaneSplit) and the open item's bar shares its row; item tabs float at the pane's top (PageTabsEdge) instead of stacking on the shell's tab bar; the floating tab pill no longer swells over leftover media padding. - Pipeline detail is a DetailPane on wide too; Run/Runs move from FABs into the bar's actions; name and identity live in the title pill. - Run detail title pill shows the real title with Run N, pipeline and version (the pill links to the pipeline); the body keeps only status, actions and notices; standalone detail draws the same segmented bar. - One Runs tab badge: attention outranks running. - Tests for content-behind-bar padding and the no-stacking wide layout; notes/app-chrome-fixes.md.
This commit is contained in:
@@ -7,12 +7,27 @@ import 'destination.dart';
|
||||
class ShellBarSpec {
|
||||
const ShellBarSpec({
|
||||
this.title,
|
||||
this.subtitle,
|
||||
this.subtitleIcon,
|
||||
this.onTitlePressed,
|
||||
this.titleSemanticLabel,
|
||||
this.titleKey,
|
||||
this.onBack,
|
||||
this.actions = const [],
|
||||
this.barless = false,
|
||||
});
|
||||
|
||||
final String? title;
|
||||
|
||||
/// A one-line subtitle in the title pill (the item's context: its
|
||||
/// pipeline and version), so the body need not repeat it.
|
||||
final String? subtitle;
|
||||
final IconData? subtitleIcon;
|
||||
|
||||
/// Makes the title pill a button; see `SegmentedBar.onTitlePressed`.
|
||||
final VoidCallback? onTitlePressed;
|
||||
final String? titleSemanticLabel;
|
||||
final Key? titleKey;
|
||||
final VoidCallback? onBack;
|
||||
final List<Widget> actions;
|
||||
|
||||
@@ -26,6 +41,20 @@ class ShellBarRegistry extends ChangeNotifier {
|
||||
final Map<AppDestination, (Object, ShellBarSpec)> _specs = {};
|
||||
final Map<(AppDestination, ShellBadgeKind), int> _badges = {};
|
||||
|
||||
final Map<AppDestination, int> _splits = {};
|
||||
|
||||
/// Whether a tab's screen shows a list beside an open item right now
|
||||
/// ([ShellPaneSplit]): the shell's bar then covers the list pane only, so
|
||||
/// the item's own bar shares its top row.
|
||||
bool split(AppDestination destination) => (_splits[destination] ?? 0) > 0;
|
||||
|
||||
void _setSplit(AppDestination destination, bool value) {
|
||||
if (_disposed) return;
|
||||
final before = split(destination);
|
||||
_splits[destination] = (_splits[destination] ?? 0) + (value ? 1 : -1);
|
||||
if (split(destination) != before) notifyListeners();
|
||||
}
|
||||
|
||||
/// The count a tab's screen published for [kind], 0 when none.
|
||||
int badge(AppDestination destination, ShellBadgeKind kind) =>
|
||||
_badges[(destination, kind)] ?? 0;
|
||||
@@ -92,6 +121,11 @@ class ShellBar extends StatefulWidget {
|
||||
const ShellBar({
|
||||
super.key,
|
||||
this.title,
|
||||
this.subtitle,
|
||||
this.subtitleIcon,
|
||||
this.onTitlePressed,
|
||||
this.titleSemanticLabel,
|
||||
this.titleKey,
|
||||
this.onBack,
|
||||
this.actions = const [],
|
||||
this.active = true,
|
||||
@@ -107,6 +141,13 @@ class ShellBar extends StatefulWidget {
|
||||
final bool active;
|
||||
|
||||
final String? title;
|
||||
|
||||
/// See [ShellBarSpec.subtitle].
|
||||
final String? subtitle;
|
||||
final IconData? subtitleIcon;
|
||||
final VoidCallback? onTitlePressed;
|
||||
final String? titleSemanticLabel;
|
||||
final Key? titleKey;
|
||||
final VoidCallback? onBack;
|
||||
final List<Widget> actions;
|
||||
final Widget child;
|
||||
@@ -141,6 +182,11 @@ class _ShellBarState extends State<ShellBar> {
|
||||
}
|
||||
final spec = ShellBarSpec(
|
||||
title: widget.title,
|
||||
subtitle: widget.subtitle,
|
||||
subtitleIcon: widget.subtitleIcon,
|
||||
onTitlePressed: widget.onTitlePressed,
|
||||
titleSemanticLabel: widget.titleSemanticLabel,
|
||||
titleKey: widget.titleKey,
|
||||
onBack: widget.onBack,
|
||||
actions: widget.actions,
|
||||
barless: widget.barless,
|
||||
@@ -169,6 +215,55 @@ class _ShellBarState extends State<ShellBar> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Tells the shell, while mounted, that its tab shows a list beside an open
|
||||
/// item (`ListDetailPanes`). The shell then narrows its own bar to the list
|
||||
/// pane, so each pane owns its bar on one shared top row. Outside a shell it
|
||||
/// does nothing.
|
||||
class ShellPaneSplit extends StatefulWidget {
|
||||
const ShellPaneSplit({super.key, required this.child});
|
||||
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
State<ShellPaneSplit> createState() => _ShellPaneSplitState();
|
||||
}
|
||||
|
||||
class _ShellPaneSplitState extends State<ShellPaneSplit> {
|
||||
ShellBarScope? _scope;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
final scope = ShellBarScope.maybeOf(context);
|
||||
if (scope == _scope) return;
|
||||
_release();
|
||||
_scope = scope;
|
||||
if (scope != null) {
|
||||
// The bar is above this screen; update it after this frame's build.
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => scope.registry._setSplit(scope.destination, true),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _release() {
|
||||
final scope = _scope;
|
||||
if (scope == null) return;
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => scope.registry._setSplit(scope.destination, false),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_release();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => widget.child;
|
||||
}
|
||||
|
||||
/// What a tab badge counts.
|
||||
enum ShellBadgeKind {
|
||||
/// Runs still executing.
|
||||
|
||||
Reference in New Issue
Block a user