浏览代码

fix: floatTween could be nullable in animatedOpacity

/main
xingwei.zhu 5 年前
当前提交
57029387
共有 2 个文件被更改,包括 9 次插入11 次删除
  1. 2
      Runtime/animation/tween.cs
  2. 18
      Runtime/widgets/implicit_animations.cs

2
Runtime/animation/tween.cs


}
public override float? lerp(float t) {
D.assert(this.begin != null);
D.assert(this.end != null);
return this.begin + (this.end - this.begin) * t;
}
}

18
Runtime/widgets/implicit_animations.cs


}
public bool _shouldAnimateTween<T2>(Tween<T2> tween, T2 targetValue) {
var curTargetValue = tween.end;
if (tween.end == null || typeof(T2) == typeof(float) &&
(float) Convert.ChangeType(tween.end, typeof(float)) == -1.0f) {
curTargetValue = tween.begin;
}
return !targetValue.Equals(curTargetValue);
return !targetValue.Equals(tween.end != null ? tween.end : tween.begin);
}
public void _updateTween<T2>(Tween<T2> tween, T2 targetValue) {

}
class _AnimatedOpacityState : ImplicitlyAnimatedWidgetState<AnimatedOpacity> {
FloatTween _opacity;
NullableFloatTween _opacity;
this._opacity = (FloatTween) visitor.visit(this, this._opacity, this.widget.opacity,
(float value) => new FloatTween(begin: value, end: -1.0f));
this._opacity = (NullableFloatTween) visitor.visit(this, this._opacity, this.widget.opacity,
(float? value) => new NullableFloatTween(begin: value));
this._opacityAnimation = this.animation.drive(this._opacity);
float? endValue = this._opacity.end ?? this._opacity.begin ?? null;
D.assert(endValue != null);
this._opacityAnimation = this.animation.drive(new FloatTween(begin: this._opacity.begin.Value, end: endValue.Value));
}
public override Widget build(BuildContext context) {

正在加载...
取消
保存