Make the top-bar search launcher fill the gap beside the tab title
Build APK / build (push) Successful in 5m27s

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 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 07:44:33 -04:00
co-authored by Claude Code
parent fb4829d035
commit 16aadda7b8
+11 -9
View File
@@ -109,7 +109,7 @@ class NooTopBar extends StatelessWidget implements PreferredSizeWidget {
final Widget body = _ios final Widget body = _ios
? _buildIos(colors, lead) ? _buildIos(colors, lead)
: _buildAndroid(colors, lead); : _buildAndroid(context, colors, lead);
return _NooTopBarScope( return _NooTopBarScope(
style: style, 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( return SizedBox(
height: _androidRow, height: _androidRow,
child: Padding( child: Padding(
@@ -189,14 +189,16 @@ class NooTopBar extends StatelessWidget implements PreferredSizeWidget {
spacing: 4, spacing: 4,
children: [ children: [
?lead, ?lead,
// [androidTitleTrailing]'s own doc comment explains why this // The title is a non-flex child capped at 40% of the screen
// isn't a straight replacement: the title keeps its natural // width (so it keeps its natural width but still ellipsizes),
// width (`Flexible`, not `Expanded` - it still shrinks/ // leaving the `Expanded` trailing widget all the remaining
// ellipsizes if there's truly no room, but doesn't force the // space. A `Flexible` title would instead split the free space
// row that wide otherwise) and sits to the trailing content's // 1:1 with it, since both default to flex 1.
// left rather than being displaced by it.
if (androidTitleTrailing != null) ...[ if (androidTitleTrailing != null) ...[
Flexible( ConstrainedBox(
constraints: BoxConstraints(
maxWidth: MediaQuery.sizeOf(context).width * 0.4,
),
child: Text( child: Text(
title, title,
maxLines: 1, maxLines: 1,