update BorderTween nullable (#79919)
This commit is contained in:
parent
3dbe7f23c5
commit
f11b47f7e6
@ -152,11 +152,7 @@ class BorderTween extends Tween<Border?> {
|
|||||||
|
|
||||||
/// Returns the value this variable has at the given animation clock value.
|
/// Returns the value this variable has at the given animation clock value.
|
||||||
@override
|
@override
|
||||||
Border? lerp(double t) {
|
Border? lerp(double t) => Border.lerp(begin, end, t);
|
||||||
if (begin == null || end == null)
|
|
||||||
return t < 0.5 ? begin : end;
|
|
||||||
return Border.lerp(begin!, end!, t);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An interpolation between two [Matrix4]s.
|
/// An interpolation between two [Matrix4]s.
|
||||||
|
@ -139,6 +139,17 @@ void main() {
|
|||||||
expect(animation.toStringDetails(), hasOneLineDescription);
|
expect(animation.toStringDetails(), hasOneLineDescription);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('BorderTween nullable test', () {
|
||||||
|
BorderTween tween = BorderTween();
|
||||||
|
expect(tween.lerp(0.0), null);
|
||||||
|
expect(tween.lerp(1.0), null);
|
||||||
|
|
||||||
|
tween = BorderTween(begin: null, end: const Border(top: BorderSide()));
|
||||||
|
expect(tween.lerp(0.0), const Border());
|
||||||
|
expect(tween.lerp(0.5), const Border(top: BorderSide(width: 0.5)));
|
||||||
|
expect(tween.lerp(1.0), const Border(top: BorderSide()));
|
||||||
|
});
|
||||||
|
|
||||||
test('SizeTween', () {
|
test('SizeTween', () {
|
||||||
final SizeTween tween = SizeTween(begin: Size.zero, end: const Size(20.0, 30.0));
|
final SizeTween tween = SizeTween(begin: Size.zero, end: const Size(20.0, 30.0));
|
||||||
expect(tween.lerp(0.5), equals(const Size(10.0, 15.0)));
|
expect(tween.lerp(0.5), equals(const Size(10.0, 15.0)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user