Merge branch 'worktree-agent-a82ec5e9fdf8ca159' into integrate/gaps-e

# Conflicts:
#	app/test/features/search/search_bar_layout_test.dart
This commit is contained in:
2026-10-31 04:31:13 +00:00
31 changed files with 1348 additions and 395 deletions
+36 -2
View File
@@ -18,6 +18,10 @@ export 'segmented_bar_pieces.dart' show SegmentedBackButton, SegmentedPill;
/// shrinks; only when the title is down to [minTitleShare] of the bar does
/// the first action ellipsise.
///
/// A page whose bar is mainly an input (Search) passes [titleWidget] instead:
/// it takes the title pill's place as one pill that fills the space beside
/// the leading piece (up to the widget's own width cap), with no title.
///
/// Only the pieces take taps: a tap between them reaches the content behind.
/// It works as a [Scaffold.appBar] (with `extendBodyBehindAppBar`) and a
/// [CupertinoPageScaffold.navigationBar], which inset the content by the
@@ -30,6 +34,8 @@ class SegmentedBar extends StatelessWidget
super.key,
required this.cupertino,
required this.title,
this.titleWidget,
this.titleWidgetMaxWidth = double.infinity,
this.leading,
this.automaticallyImplyLeading = true,
this.subtitle,
@@ -52,6 +58,16 @@ class SegmentedBar extends StatelessWidget
/// The title; empty shows no title pill unless there is a [subtitle].
final String title;
/// The bar's main pill when it is not a title: a search field and its
/// filters. It replaces the title pill (so [title], [subtitle] and
/// [onTitlePressed] are not drawn) and fills the width beside the leading
/// piece and any [actions], up to [titleWidgetMaxWidth].
final Widget? titleWidget;
/// The widest the [titleWidget] pill grows on a wide window; it starts at
/// the leading edge, so content below can line up with it.
final double titleWidgetMaxWidth;
/// The leading control, normally a [SegmentedBackButton].
final Widget? leading;
@@ -110,7 +126,10 @@ class SegmentedBar extends StatelessWidget
bool shouldFullyObstruct(BuildContext context) => false;
Color _background(BuildContext context) {
if (backgroundColor case final color?) return color;
if (backgroundColor case final color?) {
// A dynamic system colour (the grouped background) follows the theme.
return CupertinoDynamicColor.maybeResolve(color, context) ?? color;
}
if (cupertino) {
return context
.dependOnInheritedWidgetOfExactType<
@@ -148,7 +167,22 @@ class SegmentedBar extends StatelessWidget
child: Align(
alignment: AlignmentDirectional.centerStart,
heightFactor: 1,
child: showTitle
child: titleWidget != null
// The main pill fills the row, up to its cap.
? ConstrainedBox(
constraints: BoxConstraints(
maxWidth: titleWidgetMaxWidth,
),
child: SegmentedPill(
cupertino: cupertino,
fill: pillColor,
child: SizedBox(
width: double.infinity,
child: titleWidget,
),
),
)
: showTitle
? SegmentedTitlePill(
cupertino: cupertino,
title: title,
+56
View File
@@ -0,0 +1,56 @@
import 'package:flutter/widgets.dart';
import 'glass_pill.dart';
/// The corner radius of a [TopGlassStrip].
const double kTopGlassStripRadius = 22;
/// A page's own controls as one frosted piece floating just under its top
/// bar (a run's status and actions, a list's search and filter), so content
/// scrolls behind it as it does behind the bar.
///
/// Float it with `FloatingBarOverlay(edge: FloatingBarEdge.top)`: the strip
/// sits below the bar and the content's top padding grows by the strip's
/// height, so at rest nothing is hidden. It starts at the bar's 12px side
/// inset, is as wide as its content up to [maxWidth] (and the area), and is
/// only as tall as its content; the space beside it passes taps through.
class TopGlassStrip extends StatelessWidget {
const TopGlassStrip({
super.key,
required this.cupertino,
required this.child,
this.maxWidth = double.infinity,
this.padding = const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
});
final bool cupertino;
final Widget child;
/// The widest the strip grows on a wide window.
final double maxWidth;
/// Space between the strip's edge and [child].
final EdgeInsetsGeometry padding;
@override
Widget build(BuildContext context) {
final insets = MediaQuery.paddingOf(context);
return Padding(
padding: EdgeInsets.fromLTRB(12 + insets.left, 0, 12 + insets.right, 8),
child: Align(
alignment: AlignmentDirectional.topStart,
heightFactor: 1,
child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: maxWidth),
child: GlassPill(
cupertino: cupertino,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(kTopGlassStripRadius),
),
child: Padding(padding: padding, child: child),
),
),
),
);
}
}