forked from firka/flutter
[Material] Remove opacity from dark theme overlay check (#66596)
* Remove opacity from check and add test
This commit is contained in:
@@ -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', () {
|
||||
|
||||
Reference in New Issue
Block a user