Skip to content

Material Desktop Context Menu - #74286

Merged
justinmc merged 2 commits into
flutter:masterfrom
justinmc:desktop-context-menu-material
Jan 21, 2021
Merged

justinmc merged 2 commits into
flutter:masterfrom
justinmc:desktop-context-menu-material

Conversation

@justinmc

@justinmc justinmc commented Jan 20, 2021 •

Copy link
Copy Markdown
Contributor

A desktop right-click menu for Windows and Linux, in a Material-esque style.

Light Dark
Screen Shot 2021-01-20 at 9 59 16 AM Screen Shot 2021-01-20 at 9 59 35 AM

This is branched off of #73882 and needs to wait for that to be merged first.

See the list of known limitations tracked in #74255.

Closes #31955

@justinmc justinmc self-assigned this Jan 20, 2021
@flutter-dashboard flutter-dashboard Bot added p: cupertino_ui cupertino_ui package in flutter/packages p: material_ui material_ui package in flutter/packages framework flutter/packages/flutter repository. See also f: labels. labels Jan 20, 2021
@google-cla google-cla Bot added the cla: yes label Jan 20, 2021
@justinmc
justinmc force-pushed the desktop-context-menu-material branch from 43f1f13 to 4e435a4 Compare January 20, 2021 21:40
// * [CupertinoDesktopTextSelectionToolbar], which uses this to position itself.
// * [TextSelectionToolbarLayoutDelegate], which does a similar layout for
// the mobile text selection toolbars.
class _DesktopTextSelectionToolbarLayoutDelegate extends SingleChildLayoutDelegate {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I moved this into its own file and made it public in order to share it with the Mac and Material desktop context menus.

@justinmc
justinmc marked this pull request as ready for review January 20, 2021 21:42
@justinmc
justinmc requested a review from HansMuller January 20, 2021 21:42

@HansMuller HansMuller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@justinmc
justinmc merged commit a8471a6 into flutter:master Jan 21, 2021
@justinmc
justinmc deleted the desktop-context-menu-material branch January 21, 2021 00:29
@justinmc justinmc added the a: text input Entering text in a text field or keyboard related problems label Feb 23, 2021
@creativecreatorormaybenot

Copy link
Copy Markdown
Contributor

I am still confused as to how to use this. @justinmc are there full examples explaining usage? I have never seen this in a Flutter app. From the docs, I am not sure how to use it.

TextField, a Material Design themed wrapper of EditableText, which shows the selection toolbar upon appropriate user events based on the user's platform set in ThemeData.platform.

It sounds like it should appear on right click by default but it does not.

@justinmc

justinmc commented Apr 8, 2021

Copy link
Copy Markdown
Contributor Author

This should show up by default on desktop, but only when right clicking on EditableText-based widgets. Right clicking elsewhere does nothing, for now.

This is also purposely not customizable or reusable for now. It was a temporary solution that we plan to expand on.

@creativecreatorormaybenot

Copy link
Copy Markdown
Contributor

@justinmc Thanks. Does the first part mean that it does not show up on web?

@justinmc

justinmc commented Apr 8, 2021

Copy link
Copy Markdown
Contributor Author

Yeah that's right. Web will still show the browser's right click menu.

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

Labels

a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. p: cupertino_ui cupertino_ui package in flutter/packages p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should implement a context menu widget

3 participants