- Notifications
You must be signed in to change notification settings - Fork29.3k
[material/dropdown_menu.dart] Refactor _RenderDropdownMenuBody.computeDryLayout#176503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 correctly refactors_RenderDropdownMenuBody.computeDryLayout
to use theconstraints
parameter instead ofthis.constraints
, adhering to the framework's layout principles. It also removes a side effect withincomputeDryLayout
by no longer setting the child's offset, and simplifies the loop logic. A regression test has been added to ensurecomputeDryLayout
can be called during another render object's layout phase without causing an assertion failure. The changes are sound and improve the correctness and robustness of theDropdownMenu
widget's layout logic.
Uh oh!
There was an error while loading.Please reload this page.
_RenderDropdownMenuBody.computeDryLayout accesses this.constraints, but it should only access the constraints parameter passed into computeDryLayout. This PR removes this.constraints access.
Also, I removed a line in which the child's offset is being set in computeDryLayout. This appears to be an error:

Finally, I'm curious whether there is a reason why only the first child is being used to set the height?
Resolves#176494
Blocking#176494
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel onDiscord.
Note: The Flutter team is currently trialing the use ofGemini 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.