Unify flexible list-detail panes and highlight active pipelines and runs
This commit is contained in:
@@ -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,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user