feat(app): on a phone an open pipeline, run or chat is its own page over the tabs
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import '../../shell/destination.dart';
|
||||
import '../../shell/detail_page.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -78,6 +80,9 @@ class PipelinesScreen extends StatefulWidget {
|
||||
class _PipelinesScreenState extends State<PipelinesScreen> {
|
||||
late PipelinesController _controller;
|
||||
|
||||
/// The open pipeline is its own page over the tabs on a phone.
|
||||
final DetailPageHost _page = DetailPageHost();
|
||||
|
||||
/// Counts route stage requests so a re-read detail cannot replay an old one.
|
||||
int _stageRequest = 0;
|
||||
|
||||
@@ -132,6 +137,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_page.dispose();
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
@@ -180,21 +186,31 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
||||
final body = LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final wide = constraints.maxWidth >= kPipelinesWideBreakpoint;
|
||||
if (!wide) {
|
||||
return _controller.hasSelection
|
||||
? PipelineDetailPanel(
|
||||
controller: _controller,
|
||||
gateway: widget.gateway,
|
||||
showBack: true,
|
||||
onRunStarted: widget.onRunStarted,
|
||||
onViewPipelineRuns: widget.onViewPipelineRuns,
|
||||
stageKey: stageKey,
|
||||
stagePipelineId: widget.initialPipelineId,
|
||||
stageVersion: widget.initialVersion,
|
||||
stageRequest: _stageRequest,
|
||||
)
|
||||
: PipelineListPanel(controller: _controller);
|
||||
}
|
||||
// On a phone an open pipeline is its own page over the tabs.
|
||||
_page.sync(
|
||||
context,
|
||||
selected: _controller.hasSelection && !wide,
|
||||
destination: AppDestination.pipelines,
|
||||
onClosed: _controller.clearSelection,
|
||||
builder: (context) => AnimatedBuilder(
|
||||
animation: _controller,
|
||||
builder: (context, _) => ShellBar(
|
||||
title: _controller.detail?.displayName,
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
if (!wide) return PipelineListPanel(controller: _controller);
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
|
||||
Reference in New Issue
Block a user