-
Notifications
You must be signed in to change notification settings - Fork 29.2k
Adjust default CupertinoCheckbox size on desktop #172502
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
base: master
Are you sure you want to change the base?
Conversation
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Scuba changes are pretty bad. Maybe we can add it as an optional parameter and have it stick to its current default. |
This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
This is tricky because if we expose the tapTargetSize, there is weird behavior if they supply a size <18px: ![]() The solutions I think could work here are:
Which of these should we proceed with @MitchellGoodwin? |
My vote is for
Besides visual appearance changes, tap targets are in the realm of accessibility so I'm a little nervous to make breaking changes when it comes to that. Also, rather than 18x18, it might make sense to make the minimum 14x14. 18 is the width of the radio, 14 is the width of the checkbox. I don't know if we need to enforce having a tap target bigger than the checkbox. Right now the width of the checkbox is set by a static value. I think the min TapTargetSize and the width should point to the same value. I think we can merge this in and then consider a breaking change after. I think we might want to consider having tapTargetSize default to it's current value on mobile, and to a lower default on all other platforms. That makes the most sense to me, but would be breaking on desktop and web. |
That's an option I didn't consider. And might help with the google tests as well. Plus, it means we don't have to increase the API surface. |
Another thing to consider is that it's common to adjust the size of the checkbox with Transform.scale, so whatever we do we need to make sure it works as expected with that. |
TargetPlatform.fuchsia => const Size.square(kMinInteractiveDimensionCupertino), | ||
TargetPlatform.macOS || | ||
TargetPlatform.linux || | ||
TargetPlatform.windows => const Size.square(CupertinoCheckbox.width), |
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.
CupertinoCheckbox.width
is 14 while the size tested in the original issue is 18, which looks pretty good. Will 14 be too small?
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.
No, I think the issue has 18px because of the default macOS padding. But it's probably best to leave any additional padding customizations to the user.
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.
I think a better way is to expose a size
property that applies the platform-dependent default size in this PR. What do you think?
It gets weird because the size here doesn't actually affect the size of the checkbox, just the area that, when tapped, toggles the checkbox. |
I see that Material has a |
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, thank you
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 with one nit on the documentation
@@ -66,6 +66,9 @@ const List<double> _kDisabledDarkGradientOpacities = <double>[0.08, 0.14]; | |||
/// ([CupertinoSwitch] in Flutter) instead, or to find a creative custom | |||
/// solution. | |||
/// | |||
/// The checkbox has a default size of 14-by-14 pixels on desktop devices and |
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.
Nit: I think this should clarify that the size difference is only the tap target area and layout padding. The actual visual checkbox itself is 14-by-14 on all platforms with this change.
Fixes CupertinoCheckbox padding on MacOS is excessive, is applying iOS standards