Consider backgroundBlendMode in equality of BoxDecoration (#100788)

This commit is contained in:
Michael Goderbauer
2022-03-25 16:50:15 -07:00
committed by GitHub
parent ef8e3578c1
commit 7eeafb1287
2 changed files with 15 additions and 0 deletions

View File

@@ -320,6 +320,7 @@ class BoxDecoration extends Decoration {
&& other.borderRadius == borderRadius
&& listEquals<BoxShadow>(other.boxShadow, boxShadow)
&& other.gradient == gradient
&& other.backgroundBlendMode == backgroundBlendMode
&& other.shape == shape;
}
@@ -331,6 +332,7 @@ class BoxDecoration extends Decoration {
borderRadius,
boxShadow == null ? null : Object.hashAll(boxShadow!),
gradient,
backgroundBlendMode,
shape,
);

View File

@@ -95,4 +95,17 @@ void main() {
);
expect(clipPath, isLookLikeExpectedPath);
});
test('BoxDecorations with different blendModes are not equal', () {
// Regression test for https://github.com/flutter/flutter/issues/100754.
const BoxDecoration one = BoxDecoration(
color: Color(0x00000000),
backgroundBlendMode: BlendMode.color,
);
const BoxDecoration two = BoxDecoration(
color: Color(0x00000000),
backgroundBlendMode: BlendMode.difference,
);
expect(one == two, isFalse);
});
}