Float detail tabs at the bottom of the split detail pane and keep its bars below the status bar
This commit is contained in:
@@ -127,8 +127,8 @@ class _PipelineDetailPanelState extends State<PipelineDetailPanel> {
|
||||
final panel = LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final headerLimit = _headerLimit(constraints);
|
||||
// The tabs float over the tab body: at the bottom on a phone page,
|
||||
// under the pane's top bar beside a list (never on the shell's bar).
|
||||
// The tabs float over the bottom of the tab body, on a phone page
|
||||
// and beside a list alike (the shell's bar stays over the list).
|
||||
final edge = PageTabsEdge.of(context);
|
||||
final tabs = PipelineDetailTabs(
|
||||
selected: _tab,
|
||||
|
||||
@@ -7,8 +7,9 @@ import 'pipeline_detail_tab.dart';
|
||||
|
||||
export 'pipeline_detail_tab.dart';
|
||||
|
||||
/// The pipeline detail's tabs: the app's floating glass tab bar, full width on
|
||||
/// a phone page; beside a list, sized to its tabs under the pane's top bar.
|
||||
/// 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>`.
|
||||
|
||||
@@ -18,8 +18,8 @@ const List<RunDetailTab> renderedRunDetailTabs = [
|
||||
];
|
||||
|
||||
/// The run detail's tabs: the app's floating glass tab bar, full width at the
|
||||
/// bottom of a phone page; beside a list, under the pane's top bar (sized to
|
||||
/// its tabs) so it never stacks on the shell's own tab bar.
|
||||
/// bottom of a phone page; beside a list, sized to its tabs at the bottom of
|
||||
/// the detail pane (the shell's own tab bar stays over the list pane).
|
||||
///
|
||||
/// Float it over the tab body with `FloatingBarOverlay` at the same [edge];
|
||||
/// every tab is always visible, so a tab selected by the Graph is shown
|
||||
|
||||
@@ -364,7 +364,7 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
|
||||
// The header (status, actions, notices) is a glass strip floating
|
||||
// just under the top bar, so every tab scrolls behind both and pads
|
||||
// its first item clear of them at rest. Below it, the tabs float over
|
||||
// the tab, at its bottom on a page or at its top beside a list, and
|
||||
// the bottom of the tab (on a page and beside a list alike), and
|
||||
// the tab learns their height as its padding on that edge too. Every
|
||||
// tab gets the whole height: the scrolling tabs own their content and
|
||||
// the Graph tab fills the slot, so its canvas is never asked for an
|
||||
|
||||
@@ -165,25 +165,34 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
||||
split: split,
|
||||
bar: _segmentedBar(spec, details.label),
|
||||
);
|
||||
// The scaffolds below swap the system insets for their bars'
|
||||
// heights; panes beside a list read the real ones from here.
|
||||
final system = MediaQuery.paddingOf(context);
|
||||
if (widget.cupertino) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: topBar,
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: FloatingBarOverlay(
|
||||
bar: bar,
|
||||
child: _destinationStack(contents, index),
|
||||
return ShellSystemInsets(
|
||||
padding: system,
|
||||
child: CupertinoPageScaffold(
|
||||
navigationBar: topBar,
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: FloatingBarOverlay(
|
||||
bar: bar,
|
||||
child: _destinationStack(contents, index),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: topBar,
|
||||
body: _destinationStack(contents, index),
|
||||
extendBody: true,
|
||||
bottomNavigationBar: bar,
|
||||
return ShellSystemInsets(
|
||||
padding: system,
|
||||
child: Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: topBar,
|
||||
body: _destinationStack(contents, index),
|
||||
extendBody: true,
|
||||
bottomNavigationBar: bar,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -36,6 +36,33 @@ double listDetailBodyWidth(double window, double available) {
|
||||
double listDetailListWidth(double window, double available) =>
|
||||
math.max(0, available - 1 - listDetailBodyWidth(window, available));
|
||||
|
||||
/// The system's own insets (status bar, navigation bar) as the shell saw
|
||||
/// them, before its scaffold replaced them with its bars' heights.
|
||||
///
|
||||
/// A Material [Scaffold] with an app bar and a bottom bar removes the top and
|
||||
/// bottom padding *and* view padding from its body, so a pane beside the list
|
||||
/// cannot recover the status-bar inset from its own [MediaQuery]. The shell
|
||||
/// publishes the insets here; outside a shell the view padding stands in.
|
||||
class ShellSystemInsets extends InheritedWidget {
|
||||
const ShellSystemInsets({
|
||||
super.key,
|
||||
required this.padding,
|
||||
required super.child,
|
||||
});
|
||||
|
||||
final EdgeInsets padding;
|
||||
|
||||
static EdgeInsets of(BuildContext context) =>
|
||||
context
|
||||
.dependOnInheritedWidgetOfExactType<ShellSystemInsets>()
|
||||
?.padding ??
|
||||
MediaQuery.viewPaddingOf(context);
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(ShellSystemInsets oldWidget) =>
|
||||
padding != oldWidget.padding;
|
||||
}
|
||||
|
||||
/// Narrows a shell bar to the list pane while [split] (the tab shows its list
|
||||
/// beside an open item), placing it at the pane's [alignment]; otherwise the
|
||||
/// bar keeps the whole width it is given. The bar keeps its place in the tree
|
||||
@@ -76,8 +103,8 @@ class ListPaneWidth extends StatelessWidget {
|
||||
/// Under the shell, the list keeps the shell's bars (both narrowed to the list
|
||||
/// pane through [ShellPaneSplit], see [ListPaneWidth]) and the open item owns
|
||||
/// the rest of the window: the detail starts at the top edge and reaches the
|
||||
/// bottom edge with only the system insets as its padding, and its own tabs
|
||||
/// float at its top ([PageTabsEdge]).
|
||||
/// bottom edge with only the system insets ([ShellSystemInsets]) as its
|
||||
/// padding, and its own tabs float at its bottom, as on a phone.
|
||||
class ListDetailPanes extends StatelessWidget {
|
||||
const ListDetailPanes({super.key, required this.list, required this.detail});
|
||||
|
||||
@@ -103,19 +130,20 @@ class ListDetailPanes extends StatelessWidget {
|
||||
);
|
||||
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.
|
||||
// The shell's destination bar stays over the list pane too, so the
|
||||
// item keeps only the system's bottom inset: its own composer or
|
||||
// controls own the pane's bottom edge.
|
||||
// Beside the list the item is under neither of the shell's bars
|
||||
// (both stay over the list pane): it keeps only the system's own
|
||||
// insets, so its bar sits just below the status bar at the top
|
||||
// edge, and its tabs or composer own the pane's bottom edge,
|
||||
// floating just above the system inset.
|
||||
final system = ShellSystemInsets.of(context);
|
||||
body = MediaQuery(
|
||||
data: media.copyWith(
|
||||
padding: media.padding.copyWith(
|
||||
top: media.viewPadding.top,
|
||||
bottom: media.viewPadding.bottom,
|
||||
top: system.top,
|
||||
bottom: system.bottom,
|
||||
),
|
||||
),
|
||||
child: PageTabsEdge(edge: FloatingBarEdge.top, child: body),
|
||||
child: PageTabsEdge(edge: FloatingBarEdge.bottom, child: body),
|
||||
);
|
||||
}
|
||||
return Row(
|
||||
|
||||
@@ -112,19 +112,19 @@ class SliverFloatingBarClearance extends StatelessWidget {
|
||||
|
||||
/// The edge a page's own floating tab bar sits at.
|
||||
enum FloatingBarEdge {
|
||||
/// Above the bottom safe area: a phone page, or a page covering the shell.
|
||||
/// Above the bottom safe area: a phone page, a page covering the shell,
|
||||
/// or a detail pane beside a list (the shell's tab bar stays over the
|
||||
/// list pane).
|
||||
bottom,
|
||||
|
||||
/// Just below the page's top bar: a detail pane beside a list, where the
|
||||
/// shell's own tab bar already floats at the bottom.
|
||||
/// Just below the page's top bar, for a surface whose bottom is taken.
|
||||
top,
|
||||
}
|
||||
|
||||
/// Where the pages' own tab bars float in this subtree ([FloatingBarEdge]).
|
||||
///
|
||||
/// A detail pane beside a list says [FloatingBarEdge.top], so an open item's
|
||||
/// tabs never stack on the shell's tab bar; everywhere else they float at the
|
||||
/// bottom.
|
||||
/// Pages float their tabs at the bottom (the default), including a detail
|
||||
/// pane beside a list, whose bottom the shell leaves free.
|
||||
class PageTabsEdge extends InheritedWidget {
|
||||
const PageTabsEdge({super.key, required this.edge, required super.child});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user