Make popup menu position configurable#98979
Merged
fluttergithubbot merged 6 commits intoflutter:masterfrom Mar 5, 2022
Merged
Conversation
gspencergoog
requested changes
Feb 23, 2022
975d96f to
bf7b71b
Compare
gspencergoog
requested changes
Mar 4, 2022
Contributor
gspencergoog
left a comment
There was a problem hiding this comment.
Sorry! I wrote this feedback a few days ago, and just forgot to submit.
bf34306 to
383581f
Compare
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 5, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 5, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 5, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 5, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 5, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 5, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 7, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 8, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 8, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 8, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 8, 2022
clocksmith
pushed a commit
to clocksmith/flutter
that referenced
this pull request
Mar 8, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 8, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 8, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 8, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 8, 2022
This was referenced Mar 8, 2022
This was referenced Apr 14, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

fixes #82067
Description
Currently, PopupMenuButton provides a default position for the popup menu. According to the issue and material guidelines, it should be able to position below the button, you can achieve this by providing an offset parameter however, this is roughly calculated.
According to guidelines, a popup menu should be positioned below and if there is no room, it can be positioned over the button. Flutter automatically does this calculation.
However, the default offset is still
Offset.zeroso a roughly calculated offset parameter must be provided to achieve the same design as material guidelines.Here I decided to add an enum that provides control over the position of the popup menu which calculates the height of the button itself minus vertical padding and position the menu correctly without setting rough offset every time.
This way popup menu can be positioned over or under the button without rough offset and offset can be provided if enum positions are insufficient.
Code sample
minimal code sample
Preview
Screen.Recording.2022-02-23.at.13.49.30.mov
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.