Unverified Commit 7d89f216 authored by MH Johnson's avatar MH Johnson Committed by GitHub

[Material] Remove opacity from dark theme overlay check (#66596)

* Remove opacity from check and add test
parent fd935768
......@@ -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)) {
return Color.alphaBlend(overlayColor(context, elevation), color);
}
return color;
......
......@@ -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 {
const Color surfaceColor = Color(0xFF121212);
const Color surfaceColorWithOverlay = Color(0xC6353535);
await tester.pumpWidget(
Theme(
data: ThemeData(
applyElevationOverlayColor: true,
colorScheme: const ColorScheme.dark(surface: surfaceColor),
),
child: buildMaterial(
color: surfaceColor.withOpacity(.75),
elevation: 8.0,
),
),
);
final RenderPhysicalShape model = getModel(tester);
expect(model.color, equals(surfaceColorWithOverlay));
expect(model.color, isNot(equals(surfaceColor)));
});
});
group('Transparency clipping', () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment