未验证 提交 797e094f 编写于 作者: Y Yegor 提交者: GitHub

Web: fix Color subclass handling (#13359)

上级 89731aef
......@@ -1055,7 +1055,7 @@ class Paint {
_paintData = _paintData.clone();
_frozen = false;
}
_paintData.color = value;
_paintData.color = value.runtimeType == Color ? value : Color(value.value);
}
/// Whether the colors of the image are inverted when drawn.
......
......@@ -146,6 +146,12 @@ void main() {
// Call base class member, make sure it uses overridden value.
expect(color.red, 0xE0);
});
test('Paint converts Color subclasses to plain Color', () {
final DynamicColorClass color = DynamicColorClass(0xF0E0D0C0);
final Paint paint = Paint()..color = color;
expect(paint.color.runtimeType, Color);
});
}
class DynamicColorClass extends Color {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册