Skip to content
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

Material Desktop Context Menu #74286

Merged
merged 2 commits into from Jan 21, 2021

Conversation

justinmc
Copy link
Contributor

@justinmc justinmc commented Jan 20, 2021

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 f: cupertino flutter/packages/flutter/cupertino repository f: material design flutter/packages/flutter/material repository. 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
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
Copy link
Contributor

@HansMuller HansMuller left a comment

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
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
Copy link
Contributor Author

justinmc commented Apr 8, 2021

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
Contributor

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

@justinmc
Copy link
Contributor Author

justinmc commented Apr 8, 2021

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 f: cupertino flutter/packages/flutter/cupertino repository f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should implement a context menu widget
3 participants