Unverified Commit e3a08d23 authored by Greg Spencer's avatar Greg Spencer Committed by GitHub

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
parent 2ad5376a
......@@ -232,7 +232,6 @@ abstract class ImplicitlyAnimatedWidget extends StatefulWidget {
Key key,
this.curve = Curves.linear,
@required this.duration,
this.reverseDuration,
}) : assert(curve != null),
assert(duration != null),
super(key: key);
......@@ -243,12 +242,6 @@ abstract class ImplicitlyAnimatedWidget extends StatefulWidget {
/// The duration over which to animate the parameters of this container.
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
ImplicitlyAnimatedWidgetState<ImplicitlyAnimatedWidget> createState();
......@@ -256,7 +249,6 @@ abstract class ImplicitlyAnimatedWidget extends StatefulWidget {
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
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();
_controller = AnimationController(
duration: widget.duration,
reverseDuration: widget.reverseDuration,
debugLabel: kDebugMode ? '${widget.toStringShort()}' : null,
vsync: this,
);
......@@ -332,7 +323,6 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget>
if (widget.curve != oldWidget.curve)
_updateCurve();
_controller.duration = widget.duration;
_controller.reverseDuration = widget.reverseDuration;
if (_constructTweens()) {
forEachTween((Tween<dynamic> tween, dynamic targetValue, TweenConstructor<dynamic> constructor) {
_updateTween(tween, targetValue);
......@@ -590,7 +580,6 @@ class AnimatedContainer extends ImplicitlyAnimatedWidget {
this.child,
Curve curve = Curves.linear,
@required Duration duration,
Duration reverseDuration,
}) : assert(margin == null || margin.isNonNegative),
assert(padding == null || padding.isNonNegative),
assert(decoration == null || decoration.debugAssertIsValid()),
......@@ -605,7 +594,7 @@ class AnimatedContainer extends ImplicitlyAnimatedWidget {
? constraints?.tighten(width: width, height: height)
?? BoxConstraints.tightFor(width: width, height: height)
: constraints,
super(key: key, curve: curve, duration: duration, reverseDuration: reverseDuration);
super(key: key, curve: curve, duration: duration);
/// The [child] contained by the container.
///
......@@ -747,10 +736,9 @@ class AnimatedPadding extends ImplicitlyAnimatedWidget {
this.child,
Curve curve = Curves.linear,
@required Duration duration,
Duration reverseDuration,
}) : assert(padding != null),
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.
final EdgeInsetsGeometry padding;
......@@ -819,9 +807,8 @@ class AnimatedAlign extends ImplicitlyAnimatedWidget {
this.child,
Curve curve = Curves.linear,
@required Duration duration,
Duration reverseDuration,
}) : assert(alignment != null),
super(key: key, curve: curve, duration: duration, reverseDuration: reverseDuration);
super(key: key, curve: curve, duration: duration);
/// How to align the child.
///
......@@ -920,10 +907,9 @@ class AnimatedPositioned extends ImplicitlyAnimatedWidget {
this.height,
Curve curve = Curves.linear,
@required Duration duration,
Duration reverseDuration,
}) : assert(left == null || right == null || width == 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.
///
......@@ -934,14 +920,13 @@ class AnimatedPositioned extends ImplicitlyAnimatedWidget {
Rect rect,
Curve curve = Curves.linear,
@required Duration duration,
Duration reverseDuration,
}) : left = rect.left,
top = rect.top,
width = rect.width,
height = rect.height,
right = 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.
///
......@@ -1073,10 +1058,9 @@ class AnimatedPositionedDirectional extends ImplicitlyAnimatedWidget {
this.height,
Curve curve = Curves.linear,
@required Duration duration,
Duration reverseDuration,
}) : assert(start == null || end == null || width == 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.
///
......@@ -1228,9 +1212,8 @@ class AnimatedOpacity extends ImplicitlyAnimatedWidget {
@required this.opacity,
Curve curve = Curves.linear,
@required Duration duration,
Duration reverseDuration,
}) : 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.
///
......@@ -1304,13 +1287,12 @@ class AnimatedDefaultTextStyle extends ImplicitlyAnimatedWidget {
this.maxLines,
Curve curve = Curves.linear,
@required Duration duration,
Duration reverseDuration,
}) : assert(style != null),
assert(child != null),
assert(softWrap != null),
assert(overflow != null),
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.
///
......@@ -1420,7 +1402,6 @@ class AnimatedPhysicalModel extends ImplicitlyAnimatedWidget {
this.animateShadowColor = true,
Curve curve = Curves.linear,
@required Duration duration,
Duration reverseDuration,
}) : assert(child != null),
assert(shape != null),
assert(clipBehavior != null),
......@@ -1430,7 +1411,7 @@ class AnimatedPhysicalModel extends ImplicitlyAnimatedWidget {
assert(shadowColor != null),
assert(animateColor != 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.
///
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment