Files
pipelines/app/lib/shell/list_detail.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

115 lines
4.2 KiB
Dart

import 'dart:math' as math;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../ui/adaptive/floating_bar_layout.dart';
import '../ui/adaptive/host.dart';
import 'shell_bar.dart';
/// At least this wide, a destination keeps its list beside the open item
/// (with the destination rail) instead of pushing the item as its own page.
const double kListDetailMinWidth = 600;
const double _bodyWindowTarget = 0.6;
const double _bodyWindowMinimum = 0.5;
const double _bodyAvailableMaximum = 0.75;
/// Whether the window at [context] shows list and detail side by side.
bool showsListBesideDetail(BuildContext context) =>
MediaQuery.sizeOf(context).width >= kListDetailMinWidth;
/// The open item's width beside a list, for a [window] this wide and
/// [available] width for both panes and their divider.
double listDetailBodyWidth(double window, double available) {
// Target 60% of the full window. Keep at least half for the body while
// leaving a flexible share for native list controls on tighter windows.
final requestedMinimum = window * _bodyWindowMinimum;
final minimum = available > requestedMinimum
? requestedMinimum
: available * _bodyWindowMinimum;
final maximum = math.max(minimum, available * _bodyAvailableMaximum);
return (window * _bodyWindowTarget).clamp(minimum, maximum);
}
/// The list pane's width beside an open item (see [listDetailBodyWidth]),
/// one divider excluded.
double listDetailListWidth(double window, double available) =>
math.max(0, available - 1 - listDetailBodyWidth(window, available));
/// One body-priority policy for all destinations, derived from the full window
/// and actual available space after navigation. No fixed pixel pane widths.
///
/// Under the shell, the list keeps the shell's bar (narrowed to the list pane
/// through [ShellPaneSplit]) and the open item owns the rest of the top row:
/// the detail starts at the top edge with only the system inset as its top
/// padding, and its own tabs float at its top ([PageTabsEdge]) so they never
/// stack on the shell's tab bar at the bottom.
class ListDetailPanes extends StatelessWidget {
const ListDetailPanes({super.key, required this.list, required this.detail});
final Widget list;
final Widget detail;
@override
Widget build(BuildContext context) {
final divider = usesCupertinoHost(context)
? Container(
width: 1,
color: CupertinoColors.separator.resolveFrom(context),
)
: const VerticalDivider(width: 1);
final media = MediaQuery.of(context);
final split = ShellBar.available(context);
return ShellPaneSplit(
child: LayoutBuilder(
builder: (context, constraints) {
final bodyWidth = listDetailBodyWidth(
media.size.width,
constraints.maxWidth,
);
Widget body = detail;
if (split) {
// Beside the list the item is not under the shell's bar: it keeps
// only the system's own inset and draws its bar at the top edge.
body = MediaQuery(
data: media.copyWith(
padding: media.padding.copyWith(top: media.viewPadding.top),
),
child: PageTabsEdge(edge: FloatingBarEdge.top, child: body),
);
}
return Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: SizedBox.expand(
key: const ValueKey('list-detail-list'),
child: Semantics(
container: true,
explicitChildNodes: true,
identifier: 'list-detail-list',
child: list,
),
),
),
divider,
SizedBox(
width: bodyWidth,
child: SizedBox.expand(
key: const ValueKey('list-detail-body'),
child: Semantics(
container: true,
explicitChildNodes: true,
identifier: 'list-detail-body',
child: body,
),
),
),
],
);
},
),
);
}
}