Unify flexible list-detail panes and highlight active pipelines and runs

This commit is contained in:
2026-10-25 21:04:12 +00:00
parent 6501d3e12e
commit 7e9ba9ac25
23 changed files with 579 additions and 146 deletions
+16 -39
View File
@@ -1,5 +1,6 @@
import '../../shell/destination.dart';
import '../../shell/detail_page.dart';
import '../../shell/list_detail.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@@ -15,10 +16,6 @@ import 'widgets/pipeline_list_panel.dart';
export 'pipeline_models.dart' show PipelineDetail, PipelineVersion;
/// Below this width the list and detail are separate pages; above it they sit
/// side by side. One local breakpoint, not a styling system.
const double kPipelinesWideBreakpoint = 720;
/// The read-only Pipelines destination: list, filters/sort, detail, source and
/// version history.
///
@@ -217,7 +214,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
final stageKey = _takeStageKey();
final body = LayoutBuilder(
builder: (context, constraints) {
final wide = constraints.maxWidth >= kPipelinesWideBreakpoint;
final wide = showsListBesideDetail(context);
// On a phone an open pipeline is its own page over the tabs.
_page.sync(
context,
@@ -243,29 +240,19 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
),
);
if (!wide) return PipelineListPanel(controller: _controller);
return Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
flex: 2,
child: PipelineListPanel(controller: _controller),
),
_divider(context),
Expanded(
flex: 3,
child: PipelineDetailPanel(
controller: _controller,
gateway: widget.gateway,
showBack: false,
onRunStarted: widget.onRunStarted,
onViewPipelineRuns: widget.onViewPipelineRuns,
stageKey: stageKey,
stagePipelineId: widget.initialPipelineId,
stageVersion: widget.initialVersion,
stageRequest: _stageRequest,
),
),
],
return ListDetailPanes(
list: PipelineListPanel(controller: _controller),
detail: PipelineDetailPanel(
controller: _controller,
gateway: widget.gateway,
showBack: false,
onRunStarted: widget.onRunStarted,
onViewPipelineRuns: widget.onViewPipelineRuns,
stageKey: stageKey,
stagePipelineId: widget.initialPipelineId,
stageVersion: widget.initialVersion,
stageRequest: _stageRequest,
),
);
},
);
@@ -281,7 +268,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
/// refresh in it; an open pipeline on a phone keeps refresh only.
Widget _embeddedBody(BuildContext context, Widget body) {
if (ShellBar.available(context)) {
final wide = MediaQuery.sizeOf(context).width >= kPipelinesWideBreakpoint;
final wide = showsListBesideDetail(context);
final listShown = wide || !_controller.hasSelection;
return ShellBar(
actions: [
@@ -355,16 +342,6 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
);
}
Widget _divider(BuildContext context) {
if (useCupertinoControls(context)) {
return Container(
width: 1,
color: CupertinoColors.separator.resolveFrom(context),
);
}
return const VerticalDivider(width: 1);
}
Widget _materialShell(BuildContext context, Widget body) {
return Scaffold(
appBar: AppBar(
@@ -197,6 +197,8 @@ class PipelineListPanel extends StatelessWidget {
return ListTile(
key: Key('pipeline-row-${pipeline.id}'),
selected: controller.selectedId == pipeline.id,
selectedTileColor: Theme.of(context).colorScheme.secondaryContainer,
selectedColor: Theme.of(context).colorScheme.onSecondaryContainer,
onTap: () =>
controller.openPipeline(pipeline.id, version: pipeline.version),
contentPadding: const EdgeInsets.symmetric(
@@ -219,14 +221,20 @@ class PipelineListPanel extends StatelessWidget {
backgroundColor: AppColors.groupedBackground,
children: [
for (final pipeline in items)
CupertinoListTile(
key: Key('pipeline-row-${pipeline.id}'),
title: _rowTitle(context, pipeline),
subtitle: _rowMetadata(context, pipeline, now),
trailing: const CupertinoListTileChevron(),
onTap: () => controller.openPipeline(
pipeline.id,
version: pipeline.version,
Semantics(
selected: controller.selectedId == pipeline.id,
child: CupertinoListTile(
key: Key('pipeline-row-${pipeline.id}'),
backgroundColor: controller.selectedId == pipeline.id
? CupertinoColors.tertiarySystemFill.resolveFrom(context)
: null,
title: _rowTitle(context, pipeline),
subtitle: _rowMetadata(context, pipeline, now),
trailing: const CupertinoListTileChevron(),
onTap: () => controller.openPipeline(
pipeline.id,
version: pipeline.version,
),
),
),
],
+14 -9
View File
@@ -5,6 +5,7 @@ import 'package:flutter/widgets.dart';
import '../../core/api_gateway.dart';
import '../../shell/destination.dart';
import '../../shell/detail_page.dart';
import '../../shell/list_detail.dart';
import '../../ui/adaptive/host.dart';
import '../attention/notify/notification_controller.dart';
import '../attention/runtime/attention_controller.dart';
@@ -247,9 +248,8 @@ class _RunsScreenState extends State<RunsScreen> {
@override
Widget build(BuildContext context) {
final selected = controller.selectedRunId != null;
// On a phone an open run is its own page over the tabs; a wide window
// keeps it in the tab, beside the destination rail.
final narrow = MediaQuery.sizeOf(context).width < kDetailPageMaxWidth;
// The same adaptive list/detail layout as Pipelines and Chat.
final narrow = !showsListBesideDetail(context);
_page.sync(
context,
selected: selected && narrow,
@@ -260,7 +260,7 @@ class _RunsScreenState extends State<RunsScreen> {
final list = AnimatedBuilder(
animation: controller,
builder: (context, _) => RunsList(
active: !selected,
active: narrow ? !selected : true,
controller: controller,
onSelected: _select,
syncToken: widget.syncToken,
@@ -271,11 +271,16 @@ class _RunsScreenState extends State<RunsScreen> {
),
);
if (narrow) return list;
return Stack(
children: [
Offstage(offstage: selected, child: list),
if (selected) _detail(_back),
],
return ListDetailPanes(
list: list,
detail: selected
? DetailPane(
key: const ValueKey('run-detail-pane'),
destination: AppDestination.runs,
implyBack: false,
builder: (_) => _detail(_back),
)
: const Center(child: Text('Select a run to open it here.')),
);
}
}
+24 -2
View File
@@ -199,6 +199,7 @@ class RunsList extends StatelessWidget {
final id = run['id'];
return RunListRow(
run: run,
selected: id == controller.selectedRunId,
now: DateTime.now(),
onTap: id is num ? () => onSelected(id) : null,
);
@@ -213,11 +214,13 @@ class RunListRow extends StatelessWidget {
super.key,
required this.run,
required this.now,
this.selected = false,
this.onTap,
});
final JsonMap run;
final DateTime now;
final bool selected;
final VoidCallback? onTap;
@override
@@ -233,9 +236,14 @@ class RunListRow extends StatelessWidget {
final secondary = cupertino
? CupertinoColors.secondaryLabel.resolveFrom(context)
: Theme.of(context).colorScheme.onSurfaceVariant;
final base = cupertino
final nativeStyle = cupertino
? CupertinoTheme.of(context).textTheme.textStyle
: Theme.of(context).textTheme.bodyMedium ?? const TextStyle();
final base = !cupertino && selected
? nativeStyle.copyWith(
color: Theme.of(context).colorScheme.onSecondaryContainer,
)
: nativeStyle;
final titleStyle = base.copyWith(fontWeight: FontWeight.w600);
final small = base.copyWith(
color: secondary,
@@ -304,17 +312,31 @@ class RunListRow extends StatelessWidget {
child: body,
);
return Semantics(
selected: selected,
button: onTap != null,
child: cupertino
? CupertinoButton(
key: ValueKey('run-row-$id'),
color: selected
? CupertinoColors.tertiarySystemFill.resolveFrom(context)
: null,
padding: EdgeInsets.zero,
minimumSize: Size.zero,
pressedOpacity: 0.6,
onPressed: onTap,
child: DefaultTextStyle(style: base, child: padded),
)
: InkWell(key: ValueKey('run-row-$id'), onTap: onTap, child: padded),
: Material(
key: ValueKey('run-row-surface-$id'),
color: selected
? Theme.of(context).colorScheme.secondaryContainer
: Colors.transparent,
child: InkWell(
key: ValueKey('run-row-$id'),
onTap: onTap,
child: padded,
),
),
);
}
}
+4 -1
View File
@@ -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
+10 -6
View File
@@ -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),
);
+29 -22
View File
@@ -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,
),
),
),
],
);
}
}