Keep the shell tab bar over the list pane on wide splits; cap schedules and reading bodies; share the empty-pane placeholder

This commit is contained in:
2026-10-31 12:09:47 +00:00
parent 06f6eda360
commit 2c4c4891ea
24 changed files with 851 additions and 154 deletions
+19 -20
View File
@@ -143,17 +143,26 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
// 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.
final bar = FloatingDestinationBar(
cupertino: widget.cupertino,
currentIndex: index,
onTap: (value) => _select(AppDestination.values[value]),
items: _destinationItems(),
//
// While the tab shows its list beside an open item, the bar floats
// over the list pane only (judging its placement on that width), so
// it never covers the item or stacks on the item's own composer.
final split = _bar.split(_selected);
final bar = ListPaneWidth(
split: split,
alignment: AlignmentDirectional.bottomStart,
child: FloatingDestinationBar(
cupertino: widget.cupertino,
currentIndex: index,
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),
split: split,
bar: _segmentedBar(spec, details.label),
);
if (widget.cupertino) {
@@ -277,19 +286,9 @@ class _ListPaneBar extends StatelessWidget
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),
);
},
Widget build(BuildContext context) => ListPaneWidth(
split: split,
alignment: AlignmentDirectional.topStart,
child: bar,
);
}
+49
View File
@@ -0,0 +1,49 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../ui/adaptive/host.dart';
import 'destination.dart';
/// The detail pane beside a list before anything is chosen: the
/// destination's own icon above one short muted line, centred. One look for
/// Runs, Chat and Pipelines.
class EmptyDetailPane extends StatelessWidget {
const EmptyDetailPane({
super.key,
required this.destination,
required this.message,
});
final AppDestination destination;
final String message;
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
final details = destinationDetails(destination);
final color = cupertino
? CupertinoColors.secondaryLabel.resolveFrom(context)
: Theme.of(context).colorScheme.onSurfaceVariant;
return Center(
child: Padding(
padding: const EdgeInsets.all(24),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
cupertino ? details.cupertinoIcon : details.icon,
size: 32,
color: color,
),
const SizedBox(height: 12),
Text(
message,
textAlign: TextAlign.center,
style: TextStyle(color: color),
),
],
),
),
);
}
}
+46 -6
View File
@@ -36,14 +36,48 @@ double listDetailBodyWidth(double window, double available) {
double listDetailListWidth(double window, double available) =>
math.max(0, available - 1 - listDetailBodyWidth(window, available));
/// 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
/// either way, so a split never remounts it.
class ListPaneWidth extends StatelessWidget {
const ListPaneWidth({
super.key,
required this.split,
required this.alignment,
required this.child,
});
final bool split;
final AlignmentGeometry alignment;
final Widget child;
@override
Widget build(BuildContext context) => LayoutBuilder(
builder: (context, constraints) {
final width = split
? listDetailListWidth(
MediaQuery.sizeOf(context).width,
constraints.maxWidth,
)
: constraints.maxWidth;
return Align(
alignment: alignment,
heightFactor: 1,
child: SizedBox(width: width, child: child),
);
},
);
}
/// 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.
/// 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]).
class ListDetailPanes extends StatelessWidget {
const ListDetailPanes({super.key, required this.list, required this.detail});
@@ -71,9 +105,15 @@ class ListDetailPanes extends StatelessWidget {
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.
body = MediaQuery(
data: media.copyWith(
padding: media.padding.copyWith(top: media.viewPadding.top),
padding: media.padding.copyWith(
top: media.viewPadding.top,
bottom: media.viewPadding.bottom,
),
),
child: PageTabsEdge(edge: FloatingBarEdge.top, child: body),
);