From 331509106c405e8b1a95d9ff2cf8cf25d1d73909 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Sun, 1 Nov 2026 12:57:44 +0000 Subject: [PATCH] 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. --- app/lib/ui/adaptive/segmented_bar.dart | 56 +++++++++++++++----------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/app/lib/ui/adaptive/segmented_bar.dart b/app/lib/ui/adaptive/segmented_bar.dart index ce9dea59..3eda670b 100644 --- a/app/lib/ui/adaptive/segmented_bar.dart +++ b/app/lib/ui/adaptive/segmented_bar.dart @@ -157,6 +157,12 @@ class SegmentedBar extends StatefulWidget class _SegmentedBarState extends State { 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 { } 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 { ), ), ) + : 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), + ), ), ), )