From 2102213344395e8292ad02531765e3ad1e4644b1 Mon Sep 17 00:00:00 2001 From: Vadim <44135514+vodemn@users.noreply.github.com> Date: Thu, 4 May 2023 13:14:53 +0200 Subject: [PATCH] ML-54 `AnimatedDialogState` issues (#56) * LateInitializationError: Field '_foregroundColorAnimation@1004358584' * FlutterError: Null check operator used on a null value --- .../animated_dialog/widget_dialog_animated.dart | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/animated_dialog/widget_dialog_animated.dart b/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/animated_dialog/widget_dialog_animated.dart index d2eac904..4a506cc2 100644 --- a/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/animated_dialog/widget_dialog_animated.dart +++ b/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/animated_dialog/widget_dialog_animated.dart @@ -35,8 +35,8 @@ class AnimatedDialogState extends State with SingleTickerProvide late final Animation _borderRadiusAnimation; late final Animation _closedOpacityAnimation; late final Animation _openedOpacityAnimation; - late final Animation _foregroundColorAnimation; - late final Animation _elevationAnimation; + late Animation _foregroundColorAnimation; + late Animation _elevationAnimation; bool _isDialogShown = false; @@ -185,16 +185,15 @@ class AnimatedDialogState extends State with SingleTickerProvide _animateForward(); } - void _animateForward() { + Future _animateForward() async { setState(() { _isDialogShown = true; }); - _animationController.forward(); + await _animationController.forward(); } Future _animateReverse() async { - _animationController.reverse(); - await Future.delayed(_animationController.reverseDuration! * timeDilation); + await _animationController.reverse(); setState(() { _isDialogShown = false; });