-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Implement Material MenuBar and MenuAnchor #112239
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
99ab3bb to
69e3a9d
Compare
69e3a9d to
9ab6982
Compare
4ef8f17 to
b314843
Compare
goderbauer
left a comment
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.
Not a full review, just went through the samples before lunch to warm up for the full review 😝
3f2cdf0 to
b423d53
Compare
|
Okay, I've updated the commit with the latest iteration. A word of warning: I did some spring (fall?) cleaning by changing the name of menu_bar.dart (and associated tests, examples) to menu_anchor.dart, since that is really the "star" of the file now. I also made the function order more consistent in all the classes. If you want to see just the code changes since your last review, the rename/rearrange is all in the last change, so just look at the one before that. |
goderbauer
left a comment
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.
LGTM
|
Looks like some tests are unhappy. |
f64f1ae to
2cdc081
Compare
|
auto label is removed for flutter/flutter, pr: 112239, due to - The status or check suite Linux docs_test has failed. Please fix the issues identified (or deflake) before re-applying this label.
|
|
auto label is removed for flutter/flutter, pr: 112239, due to - The status or check suite ci.yaml validation has failed. Please fix the issues identified (or deflake) before re-applying this label. |
90acd6a to
53dbf0f
Compare
|
Hi - I'm trying to change the scrollbar theme of the menu, but I cannot find the proper way to do it. I'm assuming it's because the menu is in the overlay, and it's not in the context that I'm wrapping with a scrollbartheme widget. How would you go around that? |
|
@pmartelletti Hmm. Yes, that is probably correct that it's not possible right now. Can you please file an issue about it? |
Description
This implements a
MenuBarwidget that can render a Material menu bar, and aMenuAnchorwidget used to create a cascading menu in a region. The menus are drawn in the overlay, while the menu bar itself is in the regular widget tree. Keyboard traversal works between the two.This implementation of the
MenuBarusesMenuAnchorto create a cascading menu that contains widgets representing the menu items. These menu items can be any kind of widget, but are typicallySubmenuButtons that host submenus, orMenuItemButtons that have shortcut hints (but don't actually activate the shortcuts) and don't host submenus.Cascading menus can be created outside of a
MenuBarby using aMenuAnchor. They can be either given a specific location to appear (a coordinate), or they can be located by theMenuAnchorregion that wraps the control that opens them.The developer may also create a
MenuControllerto pass to the various menu primitives (MenuBarorMenuAnchor) to associate menus so that they can be traversed together and closed together. Creating a controller is not required.Things that are not implemented in this PR, but will need to be:
This draft PR still includes the contents of #112106 as well, which will be factored out once that PR lands.
Related Issues
Previous Iterations
This is the fifth iteration of this API, as we continue to refine the API so that it is most useful, while avoiding churn in a published API. Previous (closed, not submitted) PRs for this API are:
Tests
Design Doc