-
-
Notifications
You must be signed in to change notification settings - Fork 908
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
fix: Clamp opacity set by the ColorEffect
to 1.0
#3069
Conversation
- added unit test to attempt to set opacity greater than 1
ColorEffect
to 1.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.
Lgtm, the PR description just has to be updated
All done now 🙏 |
@@ -46,7 +46,7 @@ class ColorEffect extends ComponentEffect<HasPaint> { | |||
// Currently there is a bug when opacity is 0 in the color filter. | |||
// "Expected a value of type 'SkDeletable', but got one of type 'Null'" | |||
// https://github.com/flutter/flutter/issues/89433 | |||
max(_tween.transform(progress), 1 / 255), | |||
min(max(_tween.transform(progress), 1 / 255), 1), |
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.
min(max(_tween.transform(progress), 1 / 255), 1), | |
min(max(_tween.transform(progress), 0), 1), |
The bug mentioned above is fixed, maybe we could bundle this into the PR too? And remove the comment above.
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 have updated the pr and the description.
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.
Super, thanks a lot!
- since flutter/flutter#89433 has now been fixed
Head branch was pushed to by a user without write access
Description
Clamp opacity set by the ColorEffect to 1.0; this was causing an issue when the tween returned values greater than 1.
The test shows that when dt is greater than 0.5 and less than 0.75 for a period of 1 the tween returns approx 1.2 which causes Color to throw an exception.
This has now been fixed.
Since flutter/flutter#89433 has also now been fixed, I have changed the min opacity to 0.
Checklist
docs
and added dartdoc comments with///
.examples
ordocs
.Breaking Change?
Related Issues