Skip to content

Add checkbox and radio menu buttons#112821

Merged
auto-submit[bot] merged 9 commits intoflutter:masterfrom
gspencergoog:menu_checkbox
Oct 7, 2022
Merged

Add checkbox and radio menu buttons#112821
auto-submit[bot] merged 9 commits intoflutter:masterfrom
gspencergoog:menu_checkbox

Conversation

@gspencergoog
Copy link
Contributor

Description

Adds CheckboxMenuButton and RadioMenuButton to the set of buttons designed to work inside of a menu. Includes sample code and tests for both the buttons and the samples.

Related Issues

Tests

  • Added tests for it all.

@flutter-dashboard flutter-dashboard bot added d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos documentation f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. c: contributor-productivity Team-specific productivity, code health, technical debt. labels Oct 3, 2022
@gspencergoog gspencergoog marked this pull request as ready for review October 3, 2022 21:15
@gspencergoog gspencergoog force-pushed the menu_checkbox branch 3 times, most recently from 1e8d601 to b1c7a9a Compare October 3, 2022 22:44
Copy link
Contributor

@QuncCccccc QuncCccccc left a comment

Choose a reason for hiding this comment

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

LGTM!

Sorry it takes a little long for the code review, but I got a change to learn some new widgets and the whole structure of the Menu system which is very cool=)! Left some questions, just for my education and some minor comments. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious is this IgnorePointer widget used to avoid the circular highlight for the checkbox? If so, do we still need to set the splashRadius to 0 below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is there so that the checkbox doesn't get pointer events like hover, because I don't really want it being interacted with directly. You're right that the splash radius doesn't need to be zero, I'll remove that (although it doesn't hurt anything).

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: do we need this setting if the checkbox is constrained by the ConstrainedBox?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was my attempt to reduce its size without the ConstrainedBox, which didn't work. So yes, it can be removed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Same questions here:)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I'll remove the extra arguments here too.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just a question for my learning, is the manual_tests folder used to test the keyboard event, such as the shortcuts?

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 use the manual_tests folder to put any tests that I use when validating an implementation. Basically, like an example, but instead of something "reasonable", I try and make it use all of the features of a widget or system. Then I can try them out while I am developing, or use them to reproduce problems when they are reported. So, not just keyboard and shortcut events, but all kinds of things.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it! Never used this folder before, thanks for the explanation:)

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Not sure if MenuAnchor is precise enough, should we also mention CheckboxMenuButton? Same for the RadioMenuButton code sample below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're so polite. :-). Yeah, that's just an error. It should be CheckboxMenuButton.

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 use the manual_tests folder to put any tests that I use when validating an implementation. Basically, like an example, but instead of something "reasonable", I try and make it use all of the features of a widget or system. Then I can try them out while I am developing, or use them to reproduce problems when they are reported. So, not just keyboard and shortcut events, but all kinds of things.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're so polite. :-). Yeah, that's just an error. It should be CheckboxMenuButton.

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'll fix this one too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is there so that the checkbox doesn't get pointer events like hover, because I don't really want it being interacted with directly. You're right that the splash radius doesn't need to be zero, I'll remove that (although it doesn't hurt anything).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was my attempt to reduce its size without the ConstrainedBox, which didn't work. So yes, it can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I'll remove the extra arguments here too.

@gspencergoog gspencergoog added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 7, 2022
@auto-submit auto-submit bot merged commit 6b32c06 into flutter:master Oct 7, 2022
@gspencergoog gspencergoog deleted the menu_checkbox branch October 7, 2022 22:00
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 8, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Oct 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App c: contributor-productivity Team-specific productivity, code health, technical debt. d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos 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.

2 participants