Lay out phone content above navigation bar
Use the phone NavigationBar as a real Scaffold bottom slot so destination content ends at the bar rather than scrolling beneath it. Update shell regression coverage and document the focused verification.
This commit is contained in:
@@ -232,8 +232,8 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
||||
// A phone (narrower than the list-detail split) gets a full-width Material
|
||||
// NavigationBar at the bottom, with Settings as its last destination. Wider
|
||||
// windows without the rail keep the floating glass tab bar, which the list
|
||||
// beside an open item needs (see below). Content keeps the whole width and
|
||||
// scrolls behind the bar, learning its height as its bottom media padding.
|
||||
// beside an open item needs (see below). On phones the NavigationBar is a
|
||||
// real Scaffold bottom child, so content is laid out above its surface.
|
||||
// Neither scaffold's structure depends on the width, so resizing never
|
||||
// remounts a destination. Pushed detail routes cover the shell, and a
|
||||
// bar-less spec (a chat workspace) hides the bar.
|
||||
@@ -272,9 +272,9 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
||||
);
|
||||
},
|
||||
);
|
||||
// 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).
|
||||
// Destinations may still reach the top edge and scroll behind the floating
|
||||
// top bar; the bottom phone bar is different because Scaffold reserves its
|
||||
// complete height rather than overlaying the body.
|
||||
SegmentedBar currentBar() =>
|
||||
_segmentedBar(_bar.specFor(_selected), details.label, page: page);
|
||||
final topBar = _ListPaneBar(
|
||||
@@ -317,7 +317,11 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: topBar,
|
||||
body: _destinationStack(contents),
|
||||
extendBody: true,
|
||||
// Only phone destinations use the Scaffold's real bottom slot. The
|
||||
// narrow tablet layout keeps its existing floating bar over the body.
|
||||
// The NavigationBar owns its SafeArea and therefore also owns the
|
||||
// system gesture inset at the bottom.
|
||||
extendBody: !phone,
|
||||
bottomNavigationBar: rail ? null : bar,
|
||||
);
|
||||
return backable(
|
||||
|
||||
Reference in New Issue
Block a user