feat(app): on a phone an open pipeline, run or chat is its own page over the tabs

This commit is contained in:
2026-10-23 22:58:49 +01:00
parent 700ba6f820
commit 7cbfbbbb61
8 changed files with 418 additions and 76 deletions
+42 -26
View File
@@ -3,6 +3,8 @@ import 'dart:async';
import 'package:flutter/widgets.dart';
import '../../core/api_gateway.dart';
import '../../shell/destination.dart';
import '../../shell/detail_page.dart';
import '../../ui/adaptive/host.dart';
import '../attention/notify/notification_controller.dart';
import '../attention/runtime/attention_controller.dart';
@@ -98,6 +100,9 @@ class _RunsScreenState extends State<RunsScreen> {
/// named run consumes it, whether or not that run is waiting.
bool _decideConsumed = false;
/// The open run is its own page over the tabs.
final DetailPageHost _page = DetailPageHost();
@override
void initState() {
super.initState();
@@ -224,41 +229,52 @@ class _RunsScreenState extends State<RunsScreen> {
controller.removeListener(_selectionChanged);
controller.removeListener(_pipelineFilterChanged);
controller.removeListener(_detailChanged);
_page.dispose();
controller.dispose();
super.dispose();
}
Widget _detail(VoidCallback onBack) => RunDetailView(
controller: controller,
gateway: widget.gateway,
onBack: onBack,
onRunOpened: _select,
onOpenPipeline: widget.onOpenPipeline,
initialStageKey: widget.initialStageKey,
initialVisit: widget.initialVisit,
);
@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;
_page.sync(
context,
selected: selected && narrow,
destination: AppDestination.runs,
onClosed: _back,
builder: (context) => _detail(() => Navigator.of(context).maybePop()),
);
final list = AnimatedBuilder(
animation: controller,
builder: (context, _) => RunsList(
active: !selected,
controller: controller,
onSelected: _select,
syncToken: widget.syncToken,
attentionStore: widget.attentionStore,
attentionNow: widget.attentionNow,
notifications: widget.notifications,
attention: widget.attention,
),
);
if (narrow) return list;
return Stack(
children: [
AnimatedBuilder(
animation: controller,
builder: (context, _) => Offstage(
offstage: selected,
child: RunsList(
active: !selected,
controller: controller,
onSelected: _select,
syncToken: widget.syncToken,
attentionStore: widget.attentionStore,
attentionNow: widget.attentionNow,
notifications: widget.notifications,
attention: widget.attention,
),
),
),
if (selected)
RunDetailView(
controller: controller,
gateway: widget.gateway,
onBack: _back,
onRunOpened: _select,
onOpenPipeline: widget.onOpenPipeline,
initialStageKey: widget.initialStageKey,
initialVisit: widget.initialVisit,
),
Offstage(offstage: selected, child: list),
if (selected) _detail(_back),
],
);
}