-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Update ToggleButtons constraints default and add new constraints parameter #39857
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
Update ToggleButtons constraints default and add new constraints parameter #39857
Conversation
HansMuller
left a comment
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
| } | ||
|
|
||
| final TextStyle currentTextStyle = textStyle ?? toggleButtonsTheme.textStyle ?? theme.textTheme.body1; | ||
| final BoxConstraints currentConstraints = constraints ?? toggleButtonsTheme.constraints ?? const BoxConstraints(minWidth: 48.0, minHeight: 48.0); |
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.
You can use kMinInteractiveDimension here
| /// Typically used to constrain the button's minimum size. | ||
| /// | ||
| /// If this property is null, then | ||
| /// BoxConstraints(minWidth: 48.0, minHeight: 48.0) is be used. |
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.
Although the 48 is kMinInteractiveDimension I think the documentation is easier to understand the way you have it.
…meter (flutter#39857) * Add constraints property, updated default constraints for ToggleButtons to 48x48 * Add kMinInteractiveDimension constant to ToggleButtons
Description
Currently, there is no way to control the constraints of each button in the ToggleButtons widget. It currently defaults to const
BoxConstraints(minWidth: 88.0, minHeight: 36.0), which is the constraints for RawMaterialButton, but this is undesirable if we want it to look like the square toggle buttons.This PR does the following:
constraintsparameter to ToggleButtons and ToggleButtonsThemeRequired Follow-up
Related Issues
Fixes #39216
Tests
I added the following tests:
constraintsparameterChecklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?