-
-
Notifications
You must be signed in to change notification settings - Fork 932
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
feat: Add baseColor to Shadow3DDecorator #3375
feat: Add baseColor to Shadow3DDecorator #3375
Conversation
We can probably update the |
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.
Looks good, would be good with a golden test though like you said.
Paint? _paint; | ||
Paint _makePaint() { | ||
final paint = Paint(); | ||
final color = Color.fromRGBO(0, 0, 0, opacity); | ||
final color = baseColor.withAlpha((opacity * 255).toInt()); |
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.
There is an extension on Color in Flame that does this that can be used instead.
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.
baseColor.withValues(alpha: opacity)
?
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.
Ah, it wasn't an extension, it was built-in:
https://api.flutter.dev/flutter/dart-ui/Color/withOpacity.html
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.
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.
Aah , I see!
Good to know.
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.
@spydon it looks like it might be the new withOpacity, but it might only be on the beta channel right now, so let me get that aimed back at main Flutter channel and plop withOpacity back in.
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, thanks for your contribution!
Description
The Shadow3DDecorator is very useful, but the shadow defaults to being pure black. While this is fine in most cases, sometimes a designer might request something a little bit different, so this change to allow the base color of the shadow to be changed if so desired.
Checklist
docs
and added dartdoc comments with///
.examples
ordocs
.Breaking Change?
Related Issues