浏览代码

fix animated_cross_fade.cs & animated_size.cs

/siyaoH-1.17-PlatformMessage
guanghuispark 4 年前
当前提交
e4a44cdf
共有 5 个文件被更改,包括 69 次插入11 次删除
  1. 4
      com.unity.uiwidgets/Runtime/animation/animation_controller.cs
  2. 19
      com.unity.uiwidgets/Runtime/painting/alignment.cs
  3. 18
      com.unity.uiwidgets/Runtime/rendering/animated_size.cs
  4. 19
      com.unity.uiwidgets/Runtime/widgets/animated_cross_fade.cs
  5. 20
      com.unity.uiwidgets/Runtime/widgets/animated_size.cs

4
com.unity.uiwidgets/Runtime/animation/animation_controller.cs


public AnimationController(
float? value = null,
TimeSpan? duration = null,
TimeSpan? reverseDuration = null,
string debugLabel = null,
float lowerBound = 0.0f,
float upperBound = 1.0f,

_direction = _AnimationDirection.forward;
this.duration = duration;
this.reverseDuration = reverseDuration;
this.debugLabel = debugLabel;
this.lowerBound = lowerBound;
this.upperBound = upperBound;

public TimeSpan? duration;
public TimeSpan? reverseDuration;
Ticker _ticker;
public void resync(TickerProvider vsync) {

19
com.unity.uiwidgets/Runtime/painting/alignment.cs


public AlignmentGeometry() {
}
float _x { get; }
protected float _x { get; }
float _start { get; }
protected float _start { get; }
float _y { get; }
protected float _y { get; }
// public static AlignmentGeometry add(AlignmentGeometry other) {
// return new _MixedAlignment(

// int get hashCode => hashValues(_x, _start, _y);
}
public class Alignment : IEquatable<Alignment> {
public class Alignment : AlignmentGeometry, IEquatable<Alignment> {
public Alignment(float x, float y) {
this.x = x;
this.y = y;

}
return $"Alignment({x:F1}, {y:F1})";
}
public override Alignment resolve(TextDirection? direction) {
D.assert(direction != null);
switch (direction) {
case TextDirection.rtl:
return new Alignment(_x - _start, _y);
case TextDirection.ltr:
return new Alignment(_x + _start, _y);
}
return null;
}
}
}

18
com.unity.uiwidgets/Runtime/rendering/animated_size.cs


public RenderAnimatedSize(
TickerProvider vsync = null,
TimeSpan? duration = null,
TimeSpan? reverseDuration = null,
Curve curve = null,
Alignment alignment = null,
RenderBox child = null

_vsync = vsync;
_controller = new AnimationController(
vsync: this.vsync,
duration: duration);
duration: duration,
reverseDuration: reverseDuration);
_controller.addListener(() => {
if (_controller.value != _lastValue) {
markNeedsLayout();

}
}
/// The duration of the animation when running in reverse.
public TimeSpan? reverseDuration {
get { return _controller.reverseDuration; }
set {
if (value == _controller.reverseDuration) {
return;
}
_controller.reverseDuration = value;
}
}
public Curve curve {
get { return _animation.curve; }
set {

protected override void performLayout() {
_lastValue = _controller.value;
_hasVisualOverflow = false;
BoxConstraints constraints = this.constraints;
if (child == null || constraints.isTight) {
_controller.stop();
size = _sizeTween.begin = _sizeTween.end = constraints.smallest;

19
com.unity.uiwidgets/Runtime/widgets/animated_cross_fade.cs


Alignment alignment = null,
CrossFadeState? crossFadeState = null,
TimeSpan? duration = null,
TimeSpan? reverseDuration = null,
AnimatedCrossFadeBuilder layoutBuilder = null
) : base(key: key) {
D.assert(firstChild != null);

this.sizeCurve = sizeCurve ?? Curves.linear;
this.alignment = alignment ?? Alignment.topCenter;
this.crossFadeState = crossFadeState ?? CrossFadeState.showFirst;
this.duration = duration ?? TimeSpan.Zero;
this.duration = duration;
this.reverseDuration = reverseDuration;
this.layoutBuilder = layoutBuilder ?? defaultLayoutBuilder;
}

public readonly CrossFadeState crossFadeState;
public readonly TimeSpan duration;
public readonly TimeSpan? duration;
public readonly TimeSpan? reverseDuration;
public readonly Curve firstCurve;
public readonly Curve secondCurve;

properties.add(new EnumProperty<CrossFadeState>("crossFadeState", crossFadeState));
properties.add(new DiagnosticsProperty<Alignment>("alignment", alignment,
defaultValue: Alignment.topCenter));
properties.add(new IntProperty("duration", duration?.Milliseconds, unit: "ms"));
properties.add(new IntProperty("reverseDuration", reverseDuration?.Milliseconds, unit: "ms", defaultValue: null));
}
}

public override void initState() {
base.initState();
_controller = new AnimationController(duration: widget.duration, vsync: this);
_controller = new AnimationController(
duration: widget.duration,
reverseDuration: widget.reverseDuration,
vsync: this);
if (widget.crossFadeState == CrossFadeState.showSecond) {
_controller.setValue(1.0f);
}

_controller.duration = widget.duration;
}
if (widget.reverseDuration != _oldWidget.reverseDuration)
_controller.reverseDuration = widget.reverseDuration;
if (widget.firstCurve != _oldWidget.firstCurve) {
_firstAnimation = _initAnimation(widget.firstCurve, true);
}

child: new AnimatedSize(
alignment: widget.alignment,
duration: widget.duration,
reverseDuration: widget.reverseDuration,
curve: widget.sizeCurve,
vsync: this,
child: widget.layoutBuilder(topChild, topKey, bottomChild, bottomKey)

20
com.unity.uiwidgets/Runtime/widgets/animated_size.cs


Alignment alignment = null,
Curve curve = null,
TimeSpan? duration = null,
TimeSpan? reverseDuration = null,
D.assert(reverseDuration != null);
this.duration = duration ?? TimeSpan.Zero;
this.duration = duration;
this.reverseDuration = reverseDuration;
this.vsync = vsync;
}

public readonly TimeSpan duration;
public readonly TimeSpan? duration;
public readonly TimeSpan? reverseDuration;
public readonly TickerProvider vsync;
public override RenderObject createRenderObject(BuildContext context) {

reverseDuration: reverseDuration,
curve: curve,
vsync: vsync);
}

_renderObject.alignment = alignment;
_renderObject.duration = duration;
_renderObject.reverseDuration = reverseDuration;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", alignment, defaultValue: Alignment.topCenter));
properties.add(new IntProperty("duration", duration?.Milliseconds, unit: "ms"));
properties.add(new IntProperty("reverseDuration", reverseDuration?.Milliseconds, unit: "ms", defaultValue: null));
}
}
}
正在加载...
取消
保存