feat(app): an open pipeline, run or chat fills a phone screen; Back steps up one level; stage tabs end with Session

This commit is contained in:
2026-10-23 22:49:21 +01:00
parent dd324d1f92
commit 0e6db03903
9 changed files with 104 additions and 108 deletions
+20 -1
View File
@@ -213,8 +213,13 @@ class AppRouterDelegate extends RouterDelegate<AppRoute> with ChangeNotifier {
notifyListeners();
}
/// Back (Android's button, the browser's): close whatever page sits on top
/// first, then step up one level — a stage to its run or pipeline, a run,
/// pipeline or chat to its list — and only leave the app from a list.
@override
Future<bool> popRoute() async {
final navigator = _navigatorKey.currentState;
if (navigator != null && await navigator.maybePop()) return true;
if (searchOpen) {
closeSearch();
return true;
@@ -227,10 +232,24 @@ class AppRouterDelegate extends RouterDelegate<AppRoute> with ChangeNotifier {
closeTemplates();
return true;
}
if (_route.runId != null) {
final runId = _route.runId;
if (runId != null && _route.stageKey != null) {
goTo(AppRoute.run(runId));
return true;
}
if (runId != null) {
onPopToRuns();
return true;
}
final pipelineId = _route.pipelineId;
if (_route.kind == AppRouteKind.pipelines && pipelineId != null) {
goTo(
_route.stageKey != null
? AppRoute.pipeline(pipelineId, version: _route.version)
: AppRoute.pipelines,
);
return true;
}
if (_route.chatSessionId != null) {
onPopToChat();
return true;
+4
View File
@@ -410,6 +410,10 @@ class _PipelinesAppState extends State<PipelinesApp>
final chatRoute = tab(AppDestination.chat);
return AdaptiveShell(
attentionCount: attentionCount,
detailOpen:
route.runId != null ||
route.chatSessionId != null ||
(route.kind == AppRouteKind.pipelines && route.pipelineId != null),
cupertino: _cupertino,
destination: _destinationOf(route.kind),
onDestinationSelected: _selectDestination,
@@ -128,18 +128,19 @@ class RunVisitSectionStrip extends StatelessWidget {
}
/// The stage page's tabs: Summary (Input and Output), Artifacts, Changes and
/// More (Session and Definition). The finer sections stay addressable.
/// Session. The finer sections stay addressable.
const shownVisitSections = [
RunVisitSection.summary,
RunVisitSection.artifacts,
RunVisitSection.changes,
RunVisitSection.more,
RunVisitSection.session,
];
/// The tab that shows [section].
RunVisitSection visitTabFor(RunVisitSection section) => switch (section) {
RunVisitSection.input || RunVisitSection.output => RunVisitSection.summary,
RunVisitSection.session || RunVisitSection.definition => RunVisitSection.more,
// The stage's definition lives on the pipeline, not on a run's visit.
RunVisitSection.more || RunVisitSection.definition => RunVisitSection.session,
_ => section,
};
@@ -178,10 +179,7 @@ Widget runVisitSectionBody({
cupertino: cupertino,
);
case RunVisitSection.more:
return _MoreSection(
session: body(RunVisitSection.session),
definition: body(RunVisitSection.definition),
);
return body(RunVisitSection.session);
case RunVisitSection.input:
return runDetailFieldTab(
tabKey: 'visit-input',
@@ -230,57 +228,6 @@ Widget runVisitSectionBody({
}
}
/// Session and Definition behind one tab, with a small switch between them.
class _MoreSection extends StatefulWidget {
const _MoreSection({required this.session, required this.definition});
final Widget session;
final Widget definition;
@override
State<_MoreSection> createState() => _MoreSectionState();
}
class _MoreSectionState extends State<_MoreSection> {
var _definition = false;
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
final control = cupertino
? CupertinoSlidingSegmentedControl<bool>(
key: const Key('run-visit-more-switch'),
groupValue: _definition,
onValueChanged: (value) =>
setState(() => _definition = value ?? false),
children: const {false: Text('Session'), true: Text('Definition')},
)
: SegmentedButton<bool>(
key: const Key('run-visit-more-switch'),
showSelectedIcon: false,
segments: const [
ButtonSegment(value: false, label: Text('Session')),
ButtonSegment(value: true, label: Text('Definition')),
],
selected: {_definition},
onSelectionChanged: (value) =>
setState(() => _definition = value.single),
);
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
child: control,
),
Expanded(child: _definition ? widget.definition : widget.session),
],
);
}
}
/// The stage's Input and Output as sticky collapsibles, each with a copy
/// button for its recorded text.
class _VisitSummary extends StatefulWidget {
const _VisitSummary({
super.key,
+19 -13
View File
@@ -15,6 +15,7 @@ class AdaptiveShell extends StatefulWidget {
this.onDestinationSelected,
this.onSearch,
this.attentionCount = 0,
this.detailOpen = false,
});
final Map<AppDestination, WidgetBuilder> destinationBodies;
@@ -33,6 +34,10 @@ class AdaptiveShell extends StatefulWidget {
/// so it stays visible from any destination. Zero shows no badge.
final int attentionCount;
/// A pipeline, run or chat is open: on a phone it takes the whole screen,
/// like its own page, and the destination bar steps aside until Back.
final bool detailOpen;
@override
State<AdaptiveShell> createState() => _AdaptiveShellState();
}
@@ -183,18 +188,19 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
: Column(
children: [
Expanded(child: _destinationStack(contents, index)),
CupertinoTabBar(
currentIndex: index,
onTap: (value) =>
_select(AppDestination.values[value]),
items: _items((destination) {
final item = destinationDetails(destination);
return BottomNavigationBarItem(
icon: _icon(destination, item.cupertinoIcon),
label: item.label,
);
}),
),
if (!widget.detailOpen)
CupertinoTabBar(
currentIndex: index,
onTap: (value) =>
_select(AppDestination.values[value]),
items: _items((destination) {
final item = destinationDetails(destination);
return BottomNavigationBarItem(
icon: _icon(destination, item.cupertinoIcon),
label: item.label,
);
}),
),
],
),
),
@@ -250,7 +256,7 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
Expanded(child: _destinationStack(contents, index)),
],
),
bottomNavigationBar: wide
bottomNavigationBar: wide || widget.detailOpen
? null
: NavigationBar(
selectedIndex: index,