-
Notifications
You must be signed in to change notification settings - Fork 6k
Soften shadows #17231
Soften shadows #17231
Conversation
|
|
||
| import 'scuba.dart'; | ||
|
|
||
| const Color _kShadowColor = Color.fromARGB(255, 255, 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.
why the change in test?
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.
Making the shadows softer made the red color too subtle in the golden test, so I decided to switch the test to pitch black. Also, black shadows are the most commonly used ones.
a4aa361 to
8718856
Compare
| final int alpha = (0.4 * color.alpha).round(); | ||
| context.fillStyle = colorComponentsToCssString(red, green, blue, alpha); | ||
| context.shadowBlur = shadow.blurWidth; | ||
| context.shadowColor = colorToCssString(color.withAlpha(0xff)); |
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.
Why is this overriding the alpha channel of the shadow color to 0xff?
Can we do this instead?
context.shadowColor = colorToCssString(color);
(Assuming that color has the right alpha value set?)
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.
@hterkelsen, do you recall why this was necessary? FWIW, the shadows look OK to me: https://github.com/flutter/goldens/blob/ae6003206eb721137c20cd56d8d1d8e2a76d6dd1/engine/web/shadows.png
8718856 to
1344049
Compare
Make shadows softer by pre-multiplying the alpha by 0.4 (the number is picked purely empirically by comparing the output with Flutter for desktop).
Fixes flutter/flutter#52734
This PR requires flutter/goldens#84