From 16aadda7b8abd8ff2208397c05c8e4352e68210a Mon Sep 17 00:00:00 2001 From: ayushya Date: Thu, 1 Oct 2026 07:44:33 -0400 Subject: [PATCH] Make the top-bar search launcher fill the gap beside the tab title The title was a Flexible and the search an Expanded, so both defaulted to flex 1 and split the free space evenly. The title is now a non-flex child capped at 40% of the width, leaving the search all remaining space. Co-Authored-By: Claude Code --- lib/widgets/noo/nav/noo_top_bar.dart | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/widgets/noo/nav/noo_top_bar.dart b/lib/widgets/noo/nav/noo_top_bar.dart index b739141..c7204a2 100644 --- a/lib/widgets/noo/nav/noo_top_bar.dart +++ b/lib/widgets/noo/nav/noo_top_bar.dart @@ -109,7 +109,7 @@ class NooTopBar extends StatelessWidget implements PreferredSizeWidget { final Widget body = _ios ? _buildIos(colors, lead) - : _buildAndroid(colors, lead); + : _buildAndroid(context, colors, lead); return _NooTopBarScope( style: style, @@ -177,7 +177,7 @@ class NooTopBar extends StatelessWidget implements PreferredSizeWidget { ); } - Widget _buildAndroid(NooColors colors, Widget? lead) { + Widget _buildAndroid(BuildContext context, NooColors colors, Widget? lead) { return SizedBox( height: _androidRow, child: Padding( @@ -189,14 +189,16 @@ class NooTopBar extends StatelessWidget implements PreferredSizeWidget { spacing: 4, children: [ ?lead, - // [androidTitleTrailing]'s own doc comment explains why this - // isn't a straight replacement: the title keeps its natural - // width (`Flexible`, not `Expanded` - it still shrinks/ - // ellipsizes if there's truly no room, but doesn't force the - // row that wide otherwise) and sits to the trailing content's - // left rather than being displaced by it. + // The title is a non-flex child capped at 40% of the screen + // width (so it keeps its natural width but still ellipsizes), + // leaving the `Expanded` trailing widget all the remaining + // space. A `Flexible` title would instead split the free space + // 1:1 with it, since both default to flex 1. if (androidTitleTrailing != null) ...[ - Flexible( + ConstrainedBox( + constraints: BoxConstraints( + maxWidth: MediaQuery.sizeOf(context).width * 0.4, + ), child: Text( title, maxLines: 1,