mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Remove incorrect non-nullable assumption from ShapeDecoration.lerp
(#129298)
Fixes https://github.com/flutter/flutter/issues/129299
This commit is contained in:
parent
16eb4f2c08
commit
28ca523ac2
@ -237,7 +237,7 @@ class ShapeDecoration extends Decoration {
|
||||
return ShapeDecoration(
|
||||
color: Color.lerp(a?.color, b?.color, t),
|
||||
gradient: Gradient.lerp(a?.gradient, b?.gradient, t),
|
||||
image: t < 0.5 ? a!.image : b!.image, // TODO(ianh): cross-fade the image
|
||||
image: t < 0.5 ? a?.image : b?.image, // TODO(ianh): cross-fade the image
|
||||
shadows: BoxShadow.lerpList(a?.shadows, b?.shadows, t),
|
||||
shape: ShapeBorder.lerp(a?.shape, b?.shape, t)!,
|
||||
);
|
||||
|
@ -48,6 +48,14 @@ void main() {
|
||||
expect(identical(ShapeDecoration.lerp(shape, shape, 0.5), shape), true);
|
||||
});
|
||||
|
||||
test('ShapeDecoration.lerp null a,b', () {
|
||||
const Decoration a = ShapeDecoration(shape: CircleBorder());
|
||||
const Decoration b = ShapeDecoration(shape: RoundedRectangleBorder());
|
||||
expect(Decoration.lerp(a, null, 0.0), a);
|
||||
expect(Decoration.lerp(null, b, 0.0), b);
|
||||
expect(Decoration.lerp(null, null, 0.0), null);
|
||||
});
|
||||
|
||||
test('ShapeDecoration.lerp and hit test', () {
|
||||
const Decoration a = ShapeDecoration(shape: CircleBorder());
|
||||
const Decoration b = ShapeDecoration(shape: RoundedRectangleBorder());
|
||||
|
Loading…
Reference in New Issue
Block a user