Unverified Commit 50b1960a authored by fzyzcjy's avatar fzyzcjy Committed by GitHub

Change type in `ImplicitlyAnimatedWidget` to remove type cast to improve...

Change type in `ImplicitlyAnimatedWidget` to remove type cast to improve performance and style (#111849)
parent b68c69aa
......@@ -360,7 +360,7 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget>
/// The animation driving this widget's implicit animations.
Animation<double> get animation => _animation;
late Animation<double> _animation = _createCurve();
late CurvedAnimation _animation = _createCurve();
@override
void initState() {
......@@ -383,7 +383,7 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget>
void didUpdateWidget(T oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.curve != oldWidget.curve) {
(_animation as CurvedAnimation).dispose();
_animation.dispose();
_animation = _createCurve();
}
_controller.duration = widget.duration;
......@@ -405,7 +405,7 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget>
@override
void dispose() {
(_animation as CurvedAnimation).dispose();
_animation.dispose();
_controller.dispose();
super.dispose();
}
......
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