Expandable run title: full title on tap, pipeline link as an icon

Tapping the run detail's title expands it to the whole title and subtitle
with an icon button that opens the pipeline; tapping again, or another run,
collapses it. The expanded title is drawn in the overlay, anchored to the bar
and sized beside the actions, so its pipeline icon receives taps and the
actions stay visible. Other bars keep their title behaviour. Finishes run #224.
This commit is contained in:
2026-11-01 12:57:44 +00:00
parent 6e6559235f
commit 331509106c
+33 -23
View File
@@ -157,6 +157,12 @@ class SegmentedBar extends StatefulWidget
class _SegmentedBarState extends State<SegmentedBar> {
bool _expanded = false;
/// The expanded title is drawn in the overlay, anchored to the collapsed
/// pill: drawn inside the bar it would overflow the bar's bounds, where
/// its pipeline action could be seen but not tapped.
final _titleLink = LayerLink();
final _expandedTitle = OverlayPortalController();
@override
void didUpdateWidget(covariant SegmentedBar oldWidget) {
super.didUpdateWidget(oldWidget);
@@ -167,6 +173,10 @@ class _SegmentedBarState extends State<SegmentedBar> {
}
void _toggleTitle() {
// The portal stays attached once used and draws nothing while
// collapsed, so collapsing on a new run (during a rebuild) needs no
// overlay call.
if (!_expandedTitle.isShowing) _expandedTitle.show();
setState(() => _expanded = !_expanded);
}
@@ -240,35 +250,35 @@ class _SegmentedBarState extends State<SegmentedBar> {
),
),
)
: showTitle && !widget.expandableTitle
? titlePill(false)
: showTitle
? Align(
alignment: AlignmentDirectional.centerStart,
widthFactor: _expanded && widget.expandableTitle
? null
: 1,
child: ConstrainedBox(
constraints: _expanded && widget.expandableTitle
? BoxConstraints(minWidth: constraints.maxWidth)
: const BoxConstraints(),
child: Stack(
clipBehavior: Clip.none,
children: [
ExcludeSemantics(
excluding: _expanded && widget.expandableTitle,
child: titlePill(false),
),
if (_expanded && widget.expandableTitle)
Positioned(
? LayoutBuilder(
builder: (context, titleSpace) => OverlayPortal(
controller: _expandedTitle,
overlayChildBuilder: (context) =>
!(_expanded && widget.expandableTitle)
? const SizedBox.shrink()
: Positioned(
top: 0,
left: 0,
child: ConstrainedBox(
constraints: BoxConstraints(
maxWidth: constraints.maxWidth,
child: CompositedTransformFollower(
link: _titleLink,
showWhenUnlinked: false,
child: ConstrainedBox(
constraints: BoxConstraints(
maxWidth: titleSpace.maxWidth,
),
child: titlePill(true),
),
child: titlePill(true),
),
),
],
child: CompositedTransformTarget(
link: _titleLink,
child: ExcludeSemantics(
excluding: _expanded && widget.expandableTitle,
child: titlePill(false),
),
),
),
)