-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
[Material] Remove opacity from dark theme overlay check #66596
[Material] Remove opacity from dark theme overlay check #66596
Conversation
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.
@@ -49,7 +49,7 @@ class ElevationOverlay { | |||
if (elevation > 0.0 && | |||
theme.applyElevationOverlayColor && | |||
theme.brightness == Brightness.dark && | |||
color == theme.colorScheme.surface) { | |||
color.withOpacity(1.0) == theme.colorScheme.surface.withOpacity(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.
This test is getting more and more complicated. Seems like it is just a band-aid over the fact that we really don't have a concept of what is a surface and what isn't. That said, this is a good fix for now. Thx.
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.
Agreed, we are kind of patching things up. Material-Android has gotten to a stable place with dark theme logic, so hopefully once we've patched the same holes that they have, we will be able to leave it alone. Removing opacities is another part of their check.
@@ -343,6 +343,27 @@ void main() { | |||
expect(model.color, equals(Colors.cyan)); | |||
}); | |||
|
|||
testWidgets('overlay will apply to materials with a non-opaque surface color', (WidgetTester tester) async { |
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 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.
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.
LGTM
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.
██╗ ██████╗ ████████╗███╗ ███╗
██║ ██╔════╝ ╚══██╔══╝████╗ ████║
██║ ██║ ███╗ ██║ ██╔████╔██║
██║ ██║ ██║ ██║ ██║╚██╔╝██║
███████╗╚██████╔╝ ██║ ██║ ╚═╝ ██║
╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝
Description
This PR removes the opacities from the color check in the elevation overlay. This fixes the bug that
Material
s withColorScheme.surface.withOpacity(.96)
do not get the elevation overlay, even though they should.Tests
I added the following tests:
surface
color with 75% opacity still receives the dark theme overlay.Checklist
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
Did any tests fail when you ran them? Please read Handling breaking changes.