Skip to content

[material_ui] SearchAnchor overlay expands to full screen when viewport size changes - #12466

Open
elliette wants to merge 7 commits into
flutter:mainfrom
elliette:migrate-pr-186537-4
Open

[material_ui] SearchAnchor overlay expands to full screen when viewport size changes#12466
elliette wants to merge 7 commits into
flutter:mainfrom
elliette:migrate-pr-186537-4

Conversation

@elliette

@elliette elliette commented Aug 13, 2026

Copy link
Copy Markdown
Member

Port over flutter/flutter#186537 from flutter/flutter.

Fixes flutter/flutter#186154

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

@elliette elliette added the CICD Run CI/CD label Aug 13, 2026
@github-actions github-actions Bot added triage-framework Should be looked at in framework triage p: material_ui labels Aug 13, 2026
@elliette
elliette marked this pull request as ready for review August 13, 2026 20:56

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request wraps the SearchAnchor view content in a LayoutBuilder to dynamically adjust its constraints based on the parent container, enabling the full-screen view to resize on viewport changes such as device rotation. The review feedback suggests setting minWidth and minHeight to 0.0 when showFullScreenView is true to prevent potential overflow issues when parent constraints are smaller than the minimum dimensions.

Comment on lines +1148 to +1157
constraints: BoxConstraints(
minWidth: minWidth,
maxWidth: widget.showFullScreenView
? math.max(constraints.maxWidth, minWidth)
: _viewRect.width,
minHeight: minHeight,
maxHeight: widget.showFullScreenView
? math.max(constraints.maxHeight, minHeight)
: _viewRect.height,
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When widget.showFullScreenView is true, the search view is intended to be full screen. If the parent constraints are smaller than minWidth or minHeight (e.g., on very small screens or inside a small nested Navigator), forcing the constraints to minWidth/minHeight via math.max will cause the full-screen view to overflow its parent boundaries.

Instead of forcing the maximum constraints to be at least minWidth/minHeight, we can set the minWidth/minHeight to 0.0 when widget.showFullScreenView is true. This allows the full-screen view to scale down and fit perfectly within the parent constraints without overflowing or throwing assertion errors.

              constraints: BoxConstraints(
                minWidth: widget.showFullScreenView ? 0.0 : minWidth,
                maxWidth: widget.showFullScreenView
                    ? constraints.maxWidth
                    : _viewRect.width,
                minHeight: widget.showFullScreenView ? 0.0 : minHeight,
                maxHeight: widget.showFullScreenView
                    ? constraints.maxHeight
                    : _viewRect.height,
              ),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD p: material_ui triage-framework Should be looked at in framework triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search View doesn't update size on navigator resize

1 participant