浏览代码

Merge pull request #170 from UnityTech/slider

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

11
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) {
D.assert(this.begin != null);
D.assert(this.end != null);
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


}
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) {

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

正在加载...
取消
保存