Unverified Commit 28ca523a authored by Pierre-Louis's avatar Pierre-Louis Committed by GitHub

Remove incorrect non-nullable assumption from `ShapeDecoration.lerp` (#129298)

Fixes https://github.com/flutter/flutter/issues/129299
parent 16eb4f2c
......@@ -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());
......
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