mirror of
https://github.com/flutter/flutter
synced 2024-10-13 19:52:53 +00:00
Remove reverseDuration from implicitly animated widgets, since it's ignored. (#35785)
When I added reverseDuration to animation controllers in #32730, I also added it to the implicit animations that Flutter has. However, as @efortuna pointed out to me, it doesn't actually do anything there, since all of the intrinsic animations run forwards, not in the reverse direction, and there's no way to reverse them. So, this PR removes the reverseDuration argument from the implicit animations to avoid confusion. Fixes #35769
This commit is contained in:
parent
2ad5376a06
commit
e3a08d2392
|
@ -232,7 +232,6 @@ abstract class ImplicitlyAnimatedWidget extends StatefulWidget {
|
||||||
Key key,
|
Key key,
|
||||||
this.curve = Curves.linear,
|
this.curve = Curves.linear,
|
||||||
@required this.duration,
|
@required this.duration,
|
||||||
this.reverseDuration,
|
|
||||||
}) : assert(curve != null),
|
}) : assert(curve != null),
|
||||||
assert(duration != null),
|
assert(duration != null),
|
||||||
super(key: key);
|
super(key: key);
|
||||||
|
@ -243,12 +242,6 @@ abstract class ImplicitlyAnimatedWidget extends StatefulWidget {
|
||||||
/// The duration over which to animate the parameters of this container.
|
/// The duration over which to animate the parameters of this container.
|
||||||
final Duration duration;
|
final Duration duration;
|
||||||
|
|
||||||
/// The duration over which to animate the parameters of this container when
|
|
||||||
/// the animation is going in the reverse direction.
|
|
||||||
///
|
|
||||||
/// Defaults to [duration] if not specified.
|
|
||||||
final Duration reverseDuration;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ImplicitlyAnimatedWidgetState<ImplicitlyAnimatedWidget> createState();
|
ImplicitlyAnimatedWidgetState<ImplicitlyAnimatedWidget> createState();
|
||||||
|
|
||||||
|
@ -256,7 +249,6 @@ abstract class ImplicitlyAnimatedWidget extends StatefulWidget {
|
||||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||||
super.debugFillProperties(properties);
|
super.debugFillProperties(properties);
|
||||||
properties.add(IntProperty('duration', duration.inMilliseconds, unit: 'ms'));
|
properties.add(IntProperty('duration', duration.inMilliseconds, unit: 'ms'));
|
||||||
properties.add(IntProperty('reverseDuration', reverseDuration?.inMilliseconds, unit: 'ms', defaultValue: null));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +309,6 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget>
|
||||||
super.initState();
|
super.initState();
|
||||||
_controller = AnimationController(
|
_controller = AnimationController(
|
||||||
duration: widget.duration,
|
duration: widget.duration,
|
||||||
reverseDuration: widget.reverseDuration,
|
|
||||||
debugLabel: kDebugMode ? '${widget.toStringShort()}' : null,
|
debugLabel: kDebugMode ? '${widget.toStringShort()}' : null,
|
||||||
vsync: this,
|
vsync: this,
|
||||||
);
|
);
|
||||||
|
@ -332,7 +323,6 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget>
|
||||||
if (widget.curve != oldWidget.curve)
|
if (widget.curve != oldWidget.curve)
|
||||||
_updateCurve();
|
_updateCurve();
|
||||||
_controller.duration = widget.duration;
|
_controller.duration = widget.duration;
|
||||||
_controller.reverseDuration = widget.reverseDuration;
|
|
||||||
if (_constructTweens()) {
|
if (_constructTweens()) {
|
||||||
forEachTween((Tween<dynamic> tween, dynamic targetValue, TweenConstructor<dynamic> constructor) {
|
forEachTween((Tween<dynamic> tween, dynamic targetValue, TweenConstructor<dynamic> constructor) {
|
||||||
_updateTween(tween, targetValue);
|
_updateTween(tween, targetValue);
|
||||||
|
@ -590,7 +580,6 @@ class AnimatedContainer extends ImplicitlyAnimatedWidget {
|
||||||
this.child,
|
this.child,
|
||||||
Curve curve = Curves.linear,
|
Curve curve = Curves.linear,
|
||||||
@required Duration duration,
|
@required Duration duration,
|
||||||
Duration reverseDuration,
|
|
||||||
}) : assert(margin == null || margin.isNonNegative),
|
}) : assert(margin == null || margin.isNonNegative),
|
||||||
assert(padding == null || padding.isNonNegative),
|
assert(padding == null || padding.isNonNegative),
|
||||||
assert(decoration == null || decoration.debugAssertIsValid()),
|
assert(decoration == null || decoration.debugAssertIsValid()),
|
||||||
|
@ -605,7 +594,7 @@ class AnimatedContainer extends ImplicitlyAnimatedWidget {
|
||||||
? constraints?.tighten(width: width, height: height)
|
? constraints?.tighten(width: width, height: height)
|
||||||
?? BoxConstraints.tightFor(width: width, height: height)
|
?? BoxConstraints.tightFor(width: width, height: height)
|
||||||
: constraints,
|
: constraints,
|
||||||
super(key: key, curve: curve, duration: duration, reverseDuration: reverseDuration);
|
super(key: key, curve: curve, duration: duration);
|
||||||
|
|
||||||
/// The [child] contained by the container.
|
/// The [child] contained by the container.
|
||||||
///
|
///
|
||||||
|
@ -747,10 +736,9 @@ class AnimatedPadding extends ImplicitlyAnimatedWidget {
|
||||||
this.child,
|
this.child,
|
||||||
Curve curve = Curves.linear,
|
Curve curve = Curves.linear,
|
||||||
@required Duration duration,
|
@required Duration duration,
|
||||||
Duration reverseDuration,
|
|
||||||
}) : assert(padding != null),
|
}) : assert(padding != null),
|
||||||
assert(padding.isNonNegative),
|
assert(padding.isNonNegative),
|
||||||
super(key: key, curve: curve, duration: duration, reverseDuration: reverseDuration);
|
super(key: key, curve: curve, duration: duration);
|
||||||
|
|
||||||
/// The amount of space by which to inset the child.
|
/// The amount of space by which to inset the child.
|
||||||
final EdgeInsetsGeometry padding;
|
final EdgeInsetsGeometry padding;
|
||||||
|
@ -819,9 +807,8 @@ class AnimatedAlign extends ImplicitlyAnimatedWidget {
|
||||||
this.child,
|
this.child,
|
||||||
Curve curve = Curves.linear,
|
Curve curve = Curves.linear,
|
||||||
@required Duration duration,
|
@required Duration duration,
|
||||||
Duration reverseDuration,
|
|
||||||
}) : assert(alignment != null),
|
}) : assert(alignment != null),
|
||||||
super(key: key, curve: curve, duration: duration, reverseDuration: reverseDuration);
|
super(key: key, curve: curve, duration: duration);
|
||||||
|
|
||||||
/// How to align the child.
|
/// How to align the child.
|
||||||
///
|
///
|
||||||
|
@ -920,10 +907,9 @@ class AnimatedPositioned extends ImplicitlyAnimatedWidget {
|
||||||
this.height,
|
this.height,
|
||||||
Curve curve = Curves.linear,
|
Curve curve = Curves.linear,
|
||||||
@required Duration duration,
|
@required Duration duration,
|
||||||
Duration reverseDuration,
|
|
||||||
}) : assert(left == null || right == null || width == null),
|
}) : assert(left == null || right == null || width == null),
|
||||||
assert(top == null || bottom == null || height == null),
|
assert(top == null || bottom == null || height == null),
|
||||||
super(key: key, curve: curve, duration: duration, reverseDuration: reverseDuration);
|
super(key: key, curve: curve, duration: duration);
|
||||||
|
|
||||||
/// Creates a widget that animates the rectangle it occupies implicitly.
|
/// Creates a widget that animates the rectangle it occupies implicitly.
|
||||||
///
|
///
|
||||||
|
@ -934,14 +920,13 @@ class AnimatedPositioned extends ImplicitlyAnimatedWidget {
|
||||||
Rect rect,
|
Rect rect,
|
||||||
Curve curve = Curves.linear,
|
Curve curve = Curves.linear,
|
||||||
@required Duration duration,
|
@required Duration duration,
|
||||||
Duration reverseDuration,
|
|
||||||
}) : left = rect.left,
|
}) : left = rect.left,
|
||||||
top = rect.top,
|
top = rect.top,
|
||||||
width = rect.width,
|
width = rect.width,
|
||||||
height = rect.height,
|
height = rect.height,
|
||||||
right = null,
|
right = null,
|
||||||
bottom = null,
|
bottom = null,
|
||||||
super(key: key, curve: curve, duration: duration, reverseDuration: reverseDuration);
|
super(key: key, curve: curve, duration: duration);
|
||||||
|
|
||||||
/// The widget below this widget in the tree.
|
/// The widget below this widget in the tree.
|
||||||
///
|
///
|
||||||
|
@ -1073,10 +1058,9 @@ class AnimatedPositionedDirectional extends ImplicitlyAnimatedWidget {
|
||||||
this.height,
|
this.height,
|
||||||
Curve curve = Curves.linear,
|
Curve curve = Curves.linear,
|
||||||
@required Duration duration,
|
@required Duration duration,
|
||||||
Duration reverseDuration,
|
|
||||||
}) : assert(start == null || end == null || width == null),
|
}) : assert(start == null || end == null || width == null),
|
||||||
assert(top == null || bottom == null || height == null),
|
assert(top == null || bottom == null || height == null),
|
||||||
super(key: key, curve: curve, duration: duration, reverseDuration: reverseDuration);
|
super(key: key, curve: curve, duration: duration);
|
||||||
|
|
||||||
/// The widget below this widget in the tree.
|
/// The widget below this widget in the tree.
|
||||||
///
|
///
|
||||||
|
@ -1228,9 +1212,8 @@ class AnimatedOpacity extends ImplicitlyAnimatedWidget {
|
||||||
@required this.opacity,
|
@required this.opacity,
|
||||||
Curve curve = Curves.linear,
|
Curve curve = Curves.linear,
|
||||||
@required Duration duration,
|
@required Duration duration,
|
||||||
Duration reverseDuration,
|
|
||||||
}) : assert(opacity != null && opacity >= 0.0 && opacity <= 1.0),
|
}) : assert(opacity != null && opacity >= 0.0 && opacity <= 1.0),
|
||||||
super(key: key, curve: curve, duration: duration, reverseDuration: reverseDuration);
|
super(key: key, curve: curve, duration: duration);
|
||||||
|
|
||||||
/// The widget below this widget in the tree.
|
/// The widget below this widget in the tree.
|
||||||
///
|
///
|
||||||
|
@ -1304,13 +1287,12 @@ class AnimatedDefaultTextStyle extends ImplicitlyAnimatedWidget {
|
||||||
this.maxLines,
|
this.maxLines,
|
||||||
Curve curve = Curves.linear,
|
Curve curve = Curves.linear,
|
||||||
@required Duration duration,
|
@required Duration duration,
|
||||||
Duration reverseDuration,
|
|
||||||
}) : assert(style != null),
|
}) : assert(style != null),
|
||||||
assert(child != null),
|
assert(child != null),
|
||||||
assert(softWrap != null),
|
assert(softWrap != null),
|
||||||
assert(overflow != null),
|
assert(overflow != null),
|
||||||
assert(maxLines == null || maxLines > 0),
|
assert(maxLines == null || maxLines > 0),
|
||||||
super(key: key, curve: curve, duration: duration, reverseDuration: reverseDuration);
|
super(key: key, curve: curve, duration: duration);
|
||||||
|
|
||||||
/// The widget below this widget in the tree.
|
/// The widget below this widget in the tree.
|
||||||
///
|
///
|
||||||
|
@ -1420,7 +1402,6 @@ class AnimatedPhysicalModel extends ImplicitlyAnimatedWidget {
|
||||||
this.animateShadowColor = true,
|
this.animateShadowColor = true,
|
||||||
Curve curve = Curves.linear,
|
Curve curve = Curves.linear,
|
||||||
@required Duration duration,
|
@required Duration duration,
|
||||||
Duration reverseDuration,
|
|
||||||
}) : assert(child != null),
|
}) : assert(child != null),
|
||||||
assert(shape != null),
|
assert(shape != null),
|
||||||
assert(clipBehavior != null),
|
assert(clipBehavior != null),
|
||||||
|
@ -1430,7 +1411,7 @@ class AnimatedPhysicalModel extends ImplicitlyAnimatedWidget {
|
||||||
assert(shadowColor != null),
|
assert(shadowColor != null),
|
||||||
assert(animateColor != null),
|
assert(animateColor != null),
|
||||||
assert(animateShadowColor != null),
|
assert(animateShadowColor != null),
|
||||||
super(key: key, curve: curve, duration: duration, reverseDuration: reverseDuration);
|
super(key: key, curve: curve, duration: duration);
|
||||||
|
|
||||||
/// The widget below this widget in the tree.
|
/// The widget below this widget in the tree.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue