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:
2026-10-31 03:36:22 +00:00
parent ea0f22dfc7
commit c6c6dcfe18
49 changed files with 1791 additions and 693 deletions
+63 -19
View File
@@ -7,6 +7,7 @@ import '../ui/adaptive/floating_bar_layout.dart';
import '../ui/adaptive/floating_destination_bar.dart';
import 'attention_badge.dart';
import 'destination.dart';
import 'list_detail.dart';
import 'shell_bar.dart';
class AdaptiveShell extends StatefulWidget {
@@ -95,19 +96,19 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
);
}
if (destination != AppDestination.runs) return icon;
// Runs in progress at the bottom, runs that need you at the top.
icon = ActivityBadge(
key: const ValueKey('shell.badge.runs.running'),
count: _bar.badge(destination, ShellBadgeKind.running),
label: 'runs in progress',
cupertino: widget.cupertino,
bottom: true,
child: icon,
);
// One indicator: runs that need you outrank runs in progress, so the
// tab never wears two counts at once.
final attention = widget.attentionCount > 0;
return AttentionDestinationIcon(
count: widget.attentionCount,
cupertino: widget.cupertino,
child: icon,
child: ActivityBadge(
key: const ValueKey('shell.badge.runs.running'),
count: attention ? 0 : _bar.badge(destination, ShellBadgeKind.running),
label: 'runs in progress',
cupertino: widget.cupertino,
child: icon,
),
);
}
@@ -148,10 +149,18 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
onTap: (value) => _select(AppDestination.values[value]),
items: _destinationItems(),
);
// Destinations reach the top edge and scroll behind the floating top
// bar too: each learns the bar's height as its top media padding and
// pads its own lists by it (see withTopBarClearance).
final topBar = _ListPaneBar(
split: _bar.split(_selected),
bar: _segmentedBar(spec, details.label),
);
if (widget.cupertino) {
return CupertinoPageScaffold(
navigationBar: _segmentedBar(spec, details.label),
navigationBar: topBar,
child: SafeArea(
top: false,
bottom: false,
child: FloatingBarOverlay(
bar: bar,
@@ -162,14 +171,8 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: _segmentedBar(spec, details.label),
// Destinations start below the floating top bar.
body: SafeArea(
left: false,
right: false,
bottom: false,
child: _destinationStack(contents, index),
),
appBar: topBar,
body: _destinationStack(contents, index),
extendBody: true,
bottomNavigationBar: bar,
);
@@ -208,6 +211,11 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
onPressed: onBack,
),
title: spec?.title ?? label,
subtitle: spec?.subtitle,
subtitleIcon: spec?.subtitleIcon,
onTitlePressed: spec?.onTitlePressed,
titleSemanticLabel: spec?.titleSemanticLabel,
titleKey: spec?.titleKey,
actions: [
if (published.isNotEmpty)
// A screen taking the bar over cross-fades its actions in.
@@ -244,3 +252,39 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
Widget _destinationStack(List<Widget> contents, int index) =>
IndexedStack(key: _destinationStackKey, index: index, children: contents);
}
/// The shell's top bar, over the list pane only while the tab shows a list
/// beside an open item ([ShellPaneSplit]); the item's own bar takes the rest
/// of the same row. The bar keeps its place in the scaffold either way, so a
/// split never remounts it.
class _ListPaneBar extends StatelessWidget
implements ObstructingPreferredSizeWidget {
const _ListPaneBar({required this.split, required this.bar});
final bool split;
final SegmentedBar bar;
@override
Size get preferredSize => bar.preferredSize;
@override
bool shouldFullyObstruct(BuildContext context) =>
bar.shouldFullyObstruct(context);
@override
Widget build(BuildContext context) => LayoutBuilder(
builder: (context, constraints) {
final width = split
? listDetailListWidth(
MediaQuery.sizeOf(context).width,
constraints.maxWidth,
)
: constraints.maxWidth;
return Align(
alignment: AlignmentDirectional.topStart,
heightFactor: 1,
child: SizedBox(width: width, child: bar),
);
},
);
}
+11 -8
View File
@@ -141,21 +141,24 @@ class _DetailPaneState extends State<DetailPane> {
cupertino: cupertino,
automaticallyImplyLeading: widget.implyBack,
title: title,
subtitle: spec?.subtitle,
subtitleIcon: spec?.subtitleIcon,
onTitlePressed: spec?.onTitlePressed,
titleSemanticLabel: spec?.titleSemanticLabel,
titleKey: spec?.titleKey,
actions: actions,
);
// The bottom inset (the system's, or a floating tab bar's when the
// pane sits beside a list) passes through: the open item's content
// floats its own tabs above it and pads its lists clear of it.
// Both insets pass through: the content scrolls behind the bar and
// pads its lists by the bar's height (top) and by the system's or a
// floating tab bar's (bottom), floating its own tabs clear of them.
final content = SafeArea(top: false, bottom: false, child: body);
if (cupertino) {
return CupertinoPageScaffold(
navigationBar: bar,
child: SafeArea(bottom: false, child: body),
);
return CupertinoPageScaffold(navigationBar: bar, child: content);
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: bar,
body: SafeArea(bottom: false, child: body),
body: content,
);
},
);
+73 -40
View File
@@ -3,7 +3,9 @@ import 'dart:math' as math;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../ui/adaptive/floating_bar_layout.dart';
import '../ui/adaptive/host.dart';
import 'shell_bar.dart';
/// At least this wide, a destination keeps its list beside the open item
/// (with the destination rail) instead of pushing the item as its own page.
@@ -16,8 +18,32 @@ const double _bodyAvailableMaximum = 0.75;
bool showsListBesideDetail(BuildContext context) =>
MediaQuery.sizeOf(context).width >= kListDetailMinWidth;
/// The open item's width beside a list, for a [window] this wide and
/// [available] width for both panes and their divider.
double listDetailBodyWidth(double window, double available) {
// Target 60% of the full window. Keep at least half for the body while
// leaving a flexible share for native list controls on tighter windows.
final requestedMinimum = window * _bodyWindowMinimum;
final minimum = available > requestedMinimum
? requestedMinimum
: available * _bodyWindowMinimum;
final maximum = math.max(minimum, available * _bodyAvailableMaximum);
return (window * _bodyWindowTarget).clamp(minimum, maximum);
}
/// The list pane's width beside an open item (see [listDetailBodyWidth]),
/// one divider excluded.
double listDetailListWidth(double window, double available) =>
math.max(0, available - 1 - listDetailBodyWidth(window, available));
/// One body-priority policy for all destinations, derived from the full window
/// and actual available space after navigation. No fixed pixel pane widths.
///
/// Under the shell, the list keeps the shell's bar (narrowed to the list pane
/// through [ShellPaneSplit]) and the open item owns the rest of the top row:
/// the detail starts at the top edge with only the system inset as its top
/// padding, and its own tabs float at its top ([PageTabsEdge]) so they never
/// stack on the shell's tab bar at the bottom.
class ListDetailPanes extends StatelessWidget {
const ListDetailPanes({super.key, required this.list, required this.detail});
@@ -32,50 +58,57 @@ class ListDetailPanes extends StatelessWidget {
color: CupertinoColors.separator.resolveFrom(context),
)
: const VerticalDivider(width: 1);
return LayoutBuilder(
builder: (context, constraints) {
final window = MediaQuery.sizeOf(context).width;
// Target 60% of the full window. Keep at least half for the body while
// leaving a flexible share for native list controls on tighter windows.
final requestedMinimum = window * _bodyWindowMinimum;
final minimum = constraints.maxWidth > requestedMinimum
? requestedMinimum
: constraints.maxWidth * _bodyWindowMinimum;
final maximum = math.max(
minimum,
constraints.maxWidth * _bodyAvailableMaximum,
);
final bodyWidth = (window * _bodyWindowTarget).clamp(minimum, maximum);
return Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: SizedBox.expand(
key: const ValueKey('list-detail-list'),
child: Semantics(
container: true,
explicitChildNodes: true,
identifier: 'list-detail-list',
child: list,
final media = MediaQuery.of(context);
final split = ShellBar.available(context);
return ShellPaneSplit(
child: LayoutBuilder(
builder: (context, constraints) {
final bodyWidth = listDetailBodyWidth(
media.size.width,
constraints.maxWidth,
);
Widget body = detail;
if (split) {
// Beside the list the item is not under the shell's bar: it keeps
// only the system's own inset and draws its bar at the top edge.
body = MediaQuery(
data: media.copyWith(
padding: media.padding.copyWith(top: media.viewPadding.top),
),
child: PageTabsEdge(edge: FloatingBarEdge.top, child: body),
);
}
return Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: SizedBox.expand(
key: const ValueKey('list-detail-list'),
child: Semantics(
container: true,
explicitChildNodes: true,
identifier: 'list-detail-list',
child: list,
),
),
),
),
divider,
SizedBox(
width: bodyWidth,
child: SizedBox.expand(
key: const ValueKey('list-detail-body'),
child: Semantics(
container: true,
explicitChildNodes: true,
identifier: 'list-detail-body',
child: detail,
divider,
SizedBox(
width: bodyWidth,
child: SizedBox.expand(
key: const ValueKey('list-detail-body'),
child: Semantics(
container: true,
explicitChildNodes: true,
identifier: 'list-detail-body',
child: body,
),
),
),
),
],
);
},
],
);
},
),
);
}
}
+95
View File
@@ -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.