Skip to content

Search view expands to full screen on device rotation#186537

Open
elliette wants to merge 4 commits into
flutter:masterfrom
elliette:issue-186154-fix
Open

Search view expands to full screen on device rotation#186537
elliette wants to merge 4 commits into
flutter:masterfrom
elliette:issue-186154-fix

Conversation

@elliette
Copy link
Copy Markdown
Member

Fixes #186154

The search anchor overlay now expands to fill the entire screen when the device is rotated and isFullScreen is true.

Previously we were calculating the search view's max width whenever the search view's route was pushed/popped. Switched to using the constraints provided by LayoutBuilder so that we can recalculate the view's max width during the layout phase when the device is rotated.

Before

Screenshot 2026-05-13 at 4 29 34 PM

After

Screenshot 2026-05-14 at 10 15 56 AM

Pre-launch Checklist

@elliette elliette requested a review from QuncCccccc May 14, 2026 17:17
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 14, 2026
@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels May 14, 2026
Copy link
Copy Markdown
Contributor

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

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 modifies the SearchAnchor component to ensure the search view correctly adapts to screen rotation by removing the viewMaxWidth parameter and utilizing a LayoutBuilder for dynamic constraints. It also includes a new regression test to verify full-screen expansion. Review feedback suggests that the LayoutBuilder is redundant because the view's dimensions are already updated via existing lifecycle methods, and recommends simplifying the widget tree and constraint logic to enhance readability and performance.

Comment thread packages/flutter/lib/src/material/search_anchor.dart Outdated
@elliette
Copy link
Copy Markdown
Member Author

Note: Review with "hide whitespace" 😄

Comment thread packages/flutter/lib/src/material/search_anchor.dart Outdated
Comment thread packages/flutter/lib/src/material/search_anchor.dart
@github-actions github-actions Bot removed the CICD Run CI/CD label May 15, 2026
@QuncCccccc QuncCccccc added the CICD Run CI/CD label May 15, 2026
Copy link
Copy Markdown
Contributor

@QuncCccccc QuncCccccc left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks! Once all tests pass, we can mark this as draft and move it over to material_ui package later:)!

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

Labels

CICD Run CI/CD f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search View doesn't update size on navigator resize

2 participants