Files
pipelines/app/lib/application/runs_destination.dart
T
alan c6c6dcfe18 fix(app): float content behind top bars and give each wide pane its own bar row
- Top-bar clearance helpers (withTopBarClearance, withBarClearance,
  SliverTopBarClearance, BelowTopBar, TopBarNotices); shell, DetailPane and
  the runs/pipelines/templates/artifacts/stage definition/filter/usage pages
  drop their top SafeArea and pad their own lists, pinned headers pin at the
  inset.
- Wide windows: the shell bar narrows to the list pane (ShellPaneSplit) and
  the open item's bar shares its row; item tabs float at the pane's top
  (PageTabsEdge) instead of stacking on the shell's tab bar; the floating
  tab pill no longer swells over leftover media padding.
- Pipeline detail is a DetailPane on wide too; Run/Runs move from FABs into
  the bar's actions; name and identity live in the title pill.
- Run detail title pill shows the real title with Run N, pipeline and
  version (the pill links to the pipeline); the body keeps only status,
  actions and notices; standalone detail draws the same segmented bar.
- One Runs tab badge: attention outranks running.
- Tests for content-behind-bar padding and the no-stacking wide layout;
  notes/app-chrome-fixes.md.
2026-10-31 03:36:22 +00:00

119 lines
3.9 KiB
Dart

import 'package:flutter/material.dart';
import '../features/attention/notify/notification_controller.dart';
import '../features/attention/runtime/attention_controller.dart';
import '../features/runs/screen.dart';
import '../features/runs/ui/run_pipeline_link.dart';
import '../ui/adaptive/host.dart';
import '../ui/adaptive/top_bar_notices.dart';
import 'app_session.dart';
import 'connection_status.dart';
import 'server_endpoint.dart';
/// The Runs destination: the loaded screen plus an honest connection status.
///
/// Before the first successful connection there is nothing to show, so the
/// destination is a full connection screen. After that the screen stays
/// mounted through drops and reconnects: a status banner reports reconnecting
/// or not live, and the screen reloads in place without losing the open run.
class RunsDestination extends StatelessWidget {
const RunsDestination({
super.key,
required this.session,
required this.server,
this.initialRunId,
this.initialPipelineId,
this.initialStageKey,
this.initialVisit,
this.initialDecide = false,
this.onRunSelected,
this.onBack,
this.onPipelineFilterChanged,
this.onOpenPipeline,
this.listRefreshToken = 0,
this.notifications,
this.attention,
});
final AppSession session;
final ServerEndpoint server;
final int? initialRunId;
final int? initialPipelineId;
/// The stage key and optional visit a `/runs/:id/stage/:key[?visit=N]` route
/// names. They reach the detail only through [RunsScreen]; the destination
/// does not read the route itself.
final String? initialStageKey;
final int? initialVisit;
/// The route's `?action=decide`. Forwarded as-is; the loaded screen decides
/// from the run's own detail whether a prompt exists.
final bool initialDecide;
final ValueChanged<int>? onRunSelected;
final ValueChanged<int?>? onBack;
final ValueChanged<int?>? onPipelineFilterChanged;
final OpenPipeline? onOpenPipeline;
/// Advances when a launch was accepted elsewhere. The mounted Runs screen
/// re-reads its list once; no row is inserted locally.
final int listRefreshToken;
/// The app-level notification capability shared with Settings.
final NotificationController? notifications;
/// The app-level attention controller the shell's Runs tab badge reads.
final AttentionController? attention;
@override
Widget build(BuildContext context) => AnimatedBuilder(
animation: session,
builder: (context, _) {
final cupertino = usesCupertinoHost(context);
if ((server.requiresConfiguration || server.error != null) &&
session.endpoint == null) {
return ConnectionGate(
session: session,
server: server,
cupertino: cupertino,
);
}
if (!session.everConnected) {
if (session.connected) return _runsScreen();
return ConnectionGate(
session: session,
server: server,
cupertino: cupertino,
);
}
// The banner stays below the top bar; without it the runs reach the top
// edge and scroll behind the bar.
return TopBarNotices(
notices: [
if (!session.connected ||
session.subscription == RunSubscriptionState.refused)
ConnectionBanner(session: session, cupertino: cupertino),
],
child: _runsScreen(),
);
},
);
Widget _runsScreen() => RunsScreen(
gateway: session.gateway,
initialRunId: initialRunId,
initialPipelineId: initialPipelineId,
initialStageKey: initialStageKey,
initialVisit: initialVisit,
initialDecide: initialDecide,
syncToken: session.connectionEpoch,
listRefreshToken: listRefreshToken,
notifications: notifications,
attention: attention,
onRunSelected: onRunSelected,
onBack: onBack,
onPipelineFilterChanged: onPipelineFilterChanged,
onOpenPipeline: onOpenPipeline,
);
}