From 5b8ff960514a6dafef4e28bc1cbc6987e55fc861 Mon Sep 17 00:00:00 2001 From: karvulf <36191072+karvulf@users.noreply.github.com> Date: Fri, 4 Feb 2022 13:49:09 +0100 Subject: [PATCH] Flutter Update: 2.10.0 - Fix: Looking up a deactivated widget's ancestor is unsafe fix (#499) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Looking up a deactivated widget's ancestor is unsafe fix * fixed assignment Co-authored-by: André --- lib/src/core/photo_view_core.dart | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/src/core/photo_view_core.dart b/lib/src/core/photo_view_core.dart index 74595dfb..96fa5722 100644 --- a/lib/src/core/photo_view_core.dart +++ b/lib/src/core/photo_view_core.dart @@ -108,14 +108,10 @@ class PhotoViewCoreState extends State double? _scaleBefore; double? _rotationBefore; - late final AnimationController _scaleAnimationController = - AnimationController(vsync: this) - ..addListener(handleScaleAnimation) - ..addStatusListener(onAnimationStatus); + late final AnimationController _scaleAnimationController; Animation? _scaleAnimation; - late final AnimationController _positionAnimationController = - AnimationController(vsync: this)..addListener(handlePositionAnimate); + late final AnimationController _positionAnimationController; Animation? _positionAnimation; late final AnimationController _rotationAnimationController = @@ -261,6 +257,12 @@ class PhotoViewCoreState extends State addAnimateOnScaleStateUpdate(animateOnScaleStateUpdate); cachedScaleBoundaries = widget.scaleBoundaries; + + _scaleAnimationController = AnimationController(vsync: this) + ..addListener(handleScaleAnimation) + ..addStatusListener(onAnimationStatus); + _positionAnimationController = AnimationController(vsync: this) + ..addListener(handlePositionAnimate); } void animateOnScaleStateUpdate(double prevScale, double nextScale) {