Unify flexible list-detail panes and highlight active pipelines and runs
This commit is contained in:
@@ -41,6 +41,9 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
||||
late AppDestination _selected;
|
||||
final Set<AppDestination> _visited = {};
|
||||
final ShellBarRegistry _bar = ShellBarRegistry();
|
||||
// The Cupertino sidebar and tab layouts have different parents. Preserve
|
||||
// destination selection/state while the same content moves between them.
|
||||
final GlobalKey _destinationStackKey = GlobalKey();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
@@ -274,7 +277,7 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
||||
}
|
||||
|
||||
Widget _destinationStack(List<Widget> contents, int index) =>
|
||||
IndexedStack(index: index, children: contents);
|
||||
IndexedStack(key: _destinationStackKey, index: index, children: contents);
|
||||
}
|
||||
|
||||
/// The wide-window Cupertino destination list: the web's 200px rail with the
|
||||
|
||||
@@ -5,10 +5,6 @@ import '../ui/adaptive/host.dart';
|
||||
import 'destination.dart';
|
||||
import 'shell_bar.dart';
|
||||
|
||||
/// Narrower than this, an open item is its own page; wider windows keep it
|
||||
/// beside the destination rail.
|
||||
const double kDetailPageMaxWidth = 600;
|
||||
|
||||
/// Keeps one full-screen detail page (an open run, pipeline or chat) in step
|
||||
/// with a screen's selection: selecting pushes the page over the tabs, like a
|
||||
/// new activity, and closing it (its Back, the system Back) clears the
|
||||
@@ -137,10 +133,18 @@ class _DetailPaneState extends State<DetailPane> {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
automaticallyImplyLeading: widget.implyBack,
|
||||
// Inline pane bars are not routes and must not join the shell's
|
||||
// navigation-bar hero when resizing into a pushed phone page.
|
||||
transitionBetweenRoutes: widget.implyBack,
|
||||
middle: Text(title),
|
||||
trailing: actions.isEmpty
|
||||
? null
|
||||
: Row(mainAxisSize: MainAxisSize.min, children: actions),
|
||||
: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
for (final action in actions) Flexible(child: action),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: SafeArea(child: body),
|
||||
);
|
||||
@@ -149,7 +153,7 @@ class _DetailPaneState extends State<DetailPane> {
|
||||
appBar: AppBar(
|
||||
automaticallyImplyLeading: widget.implyBack,
|
||||
title: Text(title),
|
||||
actions: actions,
|
||||
actions: [for (final action in actions) Flexible(child: action)],
|
||||
),
|
||||
body: SafeArea(top: false, child: body),
|
||||
);
|
||||
|
||||
@@ -7,17 +7,12 @@ import '../ui/adaptive/host.dart';
|
||||
/// (with the destination rail) instead of pushing the item as its own page.
|
||||
const double kListDetailMinWidth = 600;
|
||||
|
||||
/// The list pane's share of a two-pane window, bounded so neither the rows
|
||||
/// nor the open item become unusably narrow.
|
||||
const double _listFraction = 0.36;
|
||||
const double _listMinWidth = 280;
|
||||
const double _listMaxWidth = 400;
|
||||
|
||||
/// Whether the window at [context] shows list and detail side by side.
|
||||
bool showsListBesideDetail(BuildContext context) =>
|
||||
MediaQuery.sizeOf(context).width >= kListDetailMinWidth;
|
||||
|
||||
/// A list beside its open item, split by the platform's own divider.
|
||||
/// Equal flexible panes, shared by Pipelines, Runs and Chat. No destination
|
||||
/// supplies a pixel width, minimum/maximum pane width or split ratio.
|
||||
class ListDetailPanes extends StatelessWidget {
|
||||
const ListDetailPanes({super.key, required this.list, required this.detail});
|
||||
|
||||
@@ -32,21 +27,33 @@ class ListDetailPanes extends StatelessWidget {
|
||||
color: CupertinoColors.separator.resolveFrom(context),
|
||||
)
|
||||
: const VerticalDivider(width: 1);
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final width = (constraints.maxWidth * _listFraction).clamp(
|
||||
_listMinWidth,
|
||||
_listMaxWidth,
|
||||
);
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
SizedBox(width: width, child: list),
|
||||
divider,
|
||||
Expanded(child: detail),
|
||||
],
|
||||
);
|
||||
},
|
||||
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,
|
||||
Expanded(
|
||||
child: SizedBox.expand(
|
||||
key: const ValueKey('list-detail-body'),
|
||||
child: Semantics(
|
||||
container: true,
|
||||
explicitChildNodes: true,
|
||||
identifier: 'list-detail-body',
|
||||
child: detail,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user