diff --git a/lib/src/sliver_animated_tree.dart b/lib/src/sliver_animated_tree.dart index 454472a..2883ac2 100644 --- a/lib/src/sliver_animated_tree.dart +++ b/lib/src/sliver_animated_tree.dart @@ -125,6 +125,7 @@ class _SliverAnimatedTreeState final GlobalKey _listKey = GlobalKey(); + late final CurveTween _curveTween = CurveTween(curve: widget.curve); List> _flatTree = const []; void _rebuild() { @@ -158,7 +159,7 @@ class _SliverAnimatedTreeState return widget.transitionBuilder( context, widget.nodeBuilder(context, entry), - CurvedAnimation(parent: animation, curve: widget.curve), + _curveTween.animate(animation), ); }, ); @@ -188,6 +189,7 @@ class _SliverAnimatedTreeState widget.controller.addListener(_animatedRebuild); _rebuild(); } + _curveTween.curve = widget.curve; } @override @@ -212,7 +214,7 @@ class _SliverAnimatedTreeState return widget.transitionBuilder( context, widget.nodeBuilder(context, _flatTree[index]), - CurvedAnimation(parent: animation, curve: widget.curve), + _curveTween.animate(animation), ); }, ),