浏览代码

fix: floatTween could be nullable in animatedOpacity

/main
xingwei.zhu 5 年前
当前提交
447159ee
共有 3 个文件被更改,包括 24 次插入3 次删除
  1. 9
      Runtime/animation/tween.cs
  2. 10
      Runtime/widgets/implicit_animations.cs
  3. 8
      Samples/UIWidgetSample/txt/TextFieldSample.cs

9
Runtime/animation/tween.cs


}
}
public class NullableFloatTween : Tween<float?> {
public NullableFloatTween(float? begin = null, float? end = null) : base(begin: begin, end: end) {
}
public override float? lerp(float t) {
return this.begin + (this.end - this.begin) * t;
}
}
public class FloatTween : Tween<float> {
public FloatTween(float begin, float end) : base(begin: begin, end: end) {
}

10
Runtime/widgets/implicit_animations.cs


}
public bool _shouldAnimateTween<T2>(Tween<T2> tween, T2 targetValue) {
return !targetValue.Equals(tween.end == null ? tween.begin : tween.end);
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);
}
public void _updateTween<T2>(Tween<T2> tween, T2 targetValue) {

protected override void forEachTween(TweenVisitor visitor) {
this._opacity = (FloatTween) visitor.visit(this, this._opacity, this.widget.opacity,
(float value) => new FloatTween(begin: value, end: 1.0f));
(float value) => new FloatTween(begin: value, end: -1.0f));
}
protected override void didUpdateTweens() {

8
Samples/UIWidgetSample/txt/TextFieldSample.cs


),
body: new Padding(
padding: EdgeInsets.all(16.0f),
child: new TextField(controller: this.myController)
child: new TextField(
controller: this.myController,
autofocus: true,
decoration: new InputDecoration(
hintText: "hinthere",
labelText: "pwd",
prefixIcon: new Icon(Unity.UIWidgets.material.Icons.search)))
),
floatingActionButton: new FloatingActionButton(
// When the user presses the button, show an alert dialog with the

正在加载...
取消
保存