-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Context Menus #107193
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
Context Menus #107193
Conversation
232f2fa
to
92abf41
Compare
92abf41
to
6d44ca1
Compare
…ize with buttonDatas due to private classes
82750ca
to
dc85106
Compare
…as accidentally deleted
packages/flutter/lib/src/cupertino/default_text_selection_toolbar.dart
Outdated
Show resolved
Hide resolved
Hi, thx for introducing this feature. It's been very helpful. I'm wondering if the "undo" will become available for android. I had assumed all the default menu options for the platform always show up for each text field type but "undo" isn't showing up for TextFormField so I'm in need of some guidance. |
@BernardinD I'm glad this has been useful for you! I think this is the relevant issue: #107578 Would you be able to leave a comment over there with details about when the "undo" button should show up? Looking at that issue, it seems that I missed it when I investigated which buttons are missing for Android. Currently, only Cut, Copy, Paste, and Select all are built-in, but now that this PR has been merged, it should be much easier to add the missing buttons. |
Design doc
This PR makes it easy to work with context menus, the menu that shows up on right click, longpress, or when working with text selection.
tl;dr
contextMenuBuilder
parameter that allows any widget to be built as the context menu.More details below.
Deprecations
The old way of building a toolbar still works exactly as before, but it's deprecated. That's toolbarOptions and the toolbar-related parts of TextSelectionControls.
All of these have been replace by contextMenuBuilder and a suite of widgets that allow customizing the default text selection toolbar. Direct equivalents of canCopy etc. are now at TextSelectionToolbarButtonItemsBuilder.canCopy etc.
New stuff immediately deprecated
User-side changes
API changes
Open questions
child
parameter to pass a Widget to the button instead of just a text label hardcoded to a Text. A good use case would be for an icon button.show
, I have no guarantee that my menu is visible or not in the future. Will that be important? I could add an "onHidden" callback or something.Related
This PR was reopened from #104647 due to incorrectly failing customer tests, losing ~91 commits of history.
Fixes #98272
Fixes #73574
Fixes #90563
Fixes #79796
Fixes #22210
Fixes #49996
Partial fix for #74255
After deprecations are removed, will fix: #111213