Merge: main tabs under the list pane on wide layouts
This commit is contained in:
@@ -152,25 +152,34 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
||||
// Only the bar shows the registry's state, so a published bar or badge
|
||||
// rebuilds its bar alone; the destinations and scaffold stay as built.
|
||||
_bar.focus = _selected;
|
||||
// One floating glass tab bar at every width: full width on a phone,
|
||||
// sized to its tabs at the right edge on a wide window (the bar judges
|
||||
// that itself, live). Content keeps the whole width and scrolls behind
|
||||
// it, learning the bar's height as its bottom media padding. Neither
|
||||
// scaffold's structure depends on the width, so resizing never
|
||||
// One floating glass tab bar at every width: sized to its tabs at the
|
||||
// right edge, near the thumb. Content keeps the whole width and scrolls
|
||||
// behind it, learning the bar's height as its bottom media padding.
|
||||
// Neither scaffold's structure depends on the width, so resizing never
|
||||
// remounts a destination.
|
||||
//
|
||||
// While the tab shows its list beside an open item the bar keeps
|
||||
// the same place, bottom right near the thumb: the item pane learns
|
||||
// the bar's height (see ListDetailPanes) and floats its own tabs or
|
||||
// composer above it, so the two never overlap.
|
||||
// While the tab shows its list beside an open item the bar moves under
|
||||
// the list pane, centred in the list's (dragged) width, so the open item
|
||||
// keeps its whole height: the list clears the bar and the item clears
|
||||
// only the system inset (see ListDetailPanes). The bar keeps its place
|
||||
// in the tree, so a split never replays its entrance.
|
||||
final bar = ListenableBuilder(
|
||||
listenable: _bar.badges,
|
||||
builder: (context, _) => FloatingDestinationBar(
|
||||
cupertino: widget.cupertino,
|
||||
currentIndex: index,
|
||||
onTap: (value) => _select(shellTabDestinations[value]),
|
||||
items: _destinationItems(),
|
||||
),
|
||||
listenable: Listenable.merge([_bar.badges, _bar.bar, _paneWidths]),
|
||||
builder: (context, _) {
|
||||
final split = _bar.split(_selected);
|
||||
return ListPaneWidth(
|
||||
split: split,
|
||||
preferredWidth: _paneWidths.widthFor(_selected.name),
|
||||
alignment: AlignmentDirectional.bottomStart,
|
||||
child: FloatingDestinationBar(
|
||||
cupertino: widget.cupertino,
|
||||
currentIndex: index,
|
||||
onTap: (value) => _select(shellTabDestinations[value]),
|
||||
items: _destinationItems(),
|
||||
alignment: split ? Alignment.bottomCenter : null,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
// 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
|
||||
|
||||
@@ -7,8 +7,8 @@ import '../ui/adaptive/host.dart';
|
||||
///
|
||||
/// A page the item opens (a run's stage page, an artifact, a file) is pushed
|
||||
/// here, so it fills the item's pane while the list and the shell's tab bar
|
||||
/// stay in place: the page's own tabs then float above the shell's bar, as
|
||||
/// the item's tabs do. Dialogs still use the root navigator.
|
||||
/// stay in place: the page's own tabs then float at the bottom of the pane,
|
||||
/// as the item's tabs do (the shell's bar stays under the list). Dialogs still use the root navigator.
|
||||
///
|
||||
/// The item is this navigator's first page under a fixed key, so a rebuilt
|
||||
/// item updates in place and is never remounted. The system Back pops a page
|
||||
|
||||
@@ -84,11 +84,11 @@ class ListPaneWidth extends StatelessWidget {
|
||||
/// Under the shell, the list keeps the shell's top bar (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 below the status
|
||||
/// bar ([ShellSystemInsets]). The shell's tab bar stays at the bottom right,
|
||||
/// over the detail pane, so the detail learns that bar's height plus
|
||||
/// [kStackedBarGap] as its bottom padding: its own tabs (or the chat
|
||||
/// composer) float above the shell's bar, never on it, and its content clears
|
||||
/// both. Pages the item opens stay in its pane ([DetailPaneNavigator]).
|
||||
/// bar ([ShellSystemInsets]). The shell's tab bar moves to the bottom of the
|
||||
/// list pane, so the list learns that bar's height as its bottom padding and
|
||||
/// the detail keeps its whole height: its own tabs (or the chat composer) sit
|
||||
/// at its bottom edge, above the system inset only. Pages the item opens stay
|
||||
/// in its pane ([DetailPaneNavigator]).
|
||||
class ListDetailPanes extends StatefulWidget {
|
||||
const ListDetailPanes({
|
||||
super.key,
|
||||
@@ -139,20 +139,20 @@ class _ListDetailPanesState extends State<ListDetailPanes> {
|
||||
final bodyWidth = math.max(0.0, available - 1 - listWidth);
|
||||
final bounds = listPaneWidthBounds(window, available);
|
||||
Widget body = widget.detail;
|
||||
Widget listPane = widget.list;
|
||||
if (split) {
|
||||
// Beside the list the item is not under the shell's top bar (it
|
||||
// stays over the list pane): it keeps the system's own top
|
||||
// inset, so its bar sits just below the status bar at the top
|
||||
// edge. The shell's tab bar floats at the bottom right, over
|
||||
// this pane; its height (the shell's bottom padding here) plus
|
||||
// a gap lifts the item's tabs or composer above it.
|
||||
// edge. The shell's tab bar floats at the bottom of the list
|
||||
// pane, not over this one, so the item clears only the
|
||||
// system's bottom inset and its own tabs or composer sit at
|
||||
// its bottom edge.
|
||||
final system = ShellSystemInsets.of(context);
|
||||
body = MediaQuery(
|
||||
data: media.copyWith(
|
||||
padding: media.padding.copyWith(
|
||||
top: system.top,
|
||||
bottom: media.padding.bottom + kStackedBarGap,
|
||||
bottom: system.bottom,
|
||||
),
|
||||
),
|
||||
child: PageTabsEdge(
|
||||
@@ -163,15 +163,8 @@ class _ListDetailPanesState extends State<ListDetailPanes> {
|
||||
),
|
||||
),
|
||||
);
|
||||
// The tab bar sits over the detail pane, never the list (the
|
||||
// detail is at least half the window, wider than the bar), so
|
||||
// the list clears only the system's bottom inset.
|
||||
listPane = MediaQuery(
|
||||
data: media.copyWith(
|
||||
padding: media.padding.copyWith(bottom: system.bottom),
|
||||
),
|
||||
child: widget.list,
|
||||
);
|
||||
// The list keeps the shell's bottom padding (the tab bar's
|
||||
// height), so its last rows scroll clear of the bar.
|
||||
}
|
||||
return Stack(
|
||||
children: [
|
||||
@@ -185,7 +178,7 @@ class _ListDetailPanesState extends State<ListDetailPanes> {
|
||||
container: true,
|
||||
explicitChildNodes: true,
|
||||
identifier: 'list-detail-list',
|
||||
child: listPane,
|
||||
child: widget.list,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -21,7 +21,7 @@ bool showsListBesideDetail(BuildContext context) =>
|
||||
const double kListPaneMinWidth = 240;
|
||||
|
||||
/// The narrowest open item a drag leaves, beside the share of the window it
|
||||
/// always keeps (so the shell's tab bar, floating over it, still fits).
|
||||
/// always keeps (so its own tabs, floating at its bottom, still fit).
|
||||
const double kDetailPaneMinWidth = 320;
|
||||
const double _listWindowMaximum = 0.6;
|
||||
|
||||
|
||||
@@ -7,11 +7,6 @@ const double kFloatingBarWideWidth = 600;
|
||||
/// The gap between a floating tab bar and the edges (and bottom safe area).
|
||||
const double kFloatingBarMargin = 16;
|
||||
|
||||
/// The gap between two floating bars stacked at the bottom right of a wide
|
||||
/// window: the shell's tab bar and, above it, an open item's own tabs (the
|
||||
/// chat composer adds its own padding on top of this).
|
||||
const double kStackedBarGap = 12;
|
||||
|
||||
/// [padding] with the floating bar's clearance added at the bottom.
|
||||
///
|
||||
/// A scrollable under a floating bar (see [FloatingBarOverlay] and the shell)
|
||||
|
||||
@@ -36,10 +36,16 @@ class FloatingDestinationBar extends StatefulWidget {
|
||||
required this.onTap,
|
||||
required this.items,
|
||||
this.edge = FloatingBarEdge.bottom,
|
||||
this.alignment,
|
||||
});
|
||||
|
||||
final bool cupertino;
|
||||
|
||||
/// Where the row sits in the width it is given, at [FloatingBarEdge.bottom]:
|
||||
/// the trailing end by default. The shell centres its tabs under the list
|
||||
/// pane while a list shows beside an open item.
|
||||
final AlignmentGeometry? alignment;
|
||||
|
||||
/// The edge the bar floats at. At [FloatingBarEdge.top] (an open item's
|
||||
/// tabs under its pane's top bar) the bar sits at the leading edge, in line
|
||||
/// with the bar's title, and keeps no bottom safe area.
|
||||
@@ -149,7 +155,7 @@ class _FloatingDestinationBarState extends State<FloatingDestinationBar>
|
||||
heightFactor: 1,
|
||||
alignment: top
|
||||
? AlignmentDirectional.topStart
|
||||
: AlignmentDirectional.bottomEnd,
|
||||
: widget.alignment ?? AlignmentDirectional.bottomEnd,
|
||||
child: _row(context, constraints.maxWidth),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user