-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Pass MaterialButton.disabledElevation into RawMaterialButton #58209
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
Conversation
@shihaohong can you review this? Thanks |
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.
NICE. LGTM
@pedromassango |
Sure, I should fix this in the next couple of hours |
Hi @HansMuller. This is happening because of this line: The previous tests of MaterialButton widget was not taking this property into account. I'm planning to provide a top-level default value right in the MaterialButton widget. Is that right? |
Not sure I understand why we're tripping that assert? Is someone passing a negative value for disabledElevation to MaterialButton? |
Actually no. the tests are not even using it. I will just set a default value: |
The comments of |
@HansMuller any update on this? |
@@ -68,7 +68,7 @@ class MaterialButton extends StatelessWidget { | |||
this.focusElevation, | |||
this.hoverElevation, | |||
this.highlightElevation, | |||
this.disabledElevation, | |||
this.disabledElevation = 0.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.
I would modify the assert on line 90 to say
assert(disabledElevation != null && disabledElevation >= 0.0),
Since RawMaterialButton
does not allow a null disabledElevation
anyway.
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.
Yes, that sounds sensible to me.
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 agree. This would e a breaking change because the current constructor is const and doing this change requires to remove the const keyword!
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.
Here some context for the problem I managed to find: dart-lang/sdk#36511
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
Description
This PR passes the disabledElevation parameter of MaterialButton into its super widget.
Related Issues
#58201
Tests
I added the following tests:
Checklist
///
).flutter analyze --flutter-repo
) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read [Handling breaking changes].