diff --git a/lib/core/controller/controller.dart b/lib/core/controller/controller.dart index c783e62..1bb610f 100644 --- a/lib/core/controller/controller.dart +++ b/lib/core/controller/controller.dart @@ -28,10 +28,15 @@ class LazyCanvasController with ChangeNotifier { late BuildContext _context; bool debug; + final Duration defaultAnimationDuration; - LazyCanvasController({this.debug = false, Offset? buildCacheExtent, Size hashCellSize = const Size(100, 100)}) - : _hashCellSize = hashCellSize, - _buildCacheExtent = buildCacheExtent != null ? buildCacheExtent + Offset(50, 50) : null + LazyCanvasController({ + this.debug = false, + Offset? buildCacheExtent, + Size hashCellSize = const Size(100, 100), + this.defaultAnimationDuration = const Duration(milliseconds: 300), + }) : _hashCellSize = hashCellSize, + _buildCacheExtent = buildCacheExtent != null ? buildCacheExtent + Offset(50, 50) : null // only top left is considered so if a widget has long width, it'll not be rendered // unless the cache extent is sufficient { @@ -284,10 +289,10 @@ class LazyCanvasController with ChangeNotifier { Future animateToOffsetAndScale({ required Offset offset, required double scale, - Duration? duration = const Duration(milliseconds: 300), + Duration? duration, Curve curve = Curves.easeInOut, }) async { - final anim = AnimationController(vsync: _ticker!, duration: duration); + final anim = AnimationController(vsync: _ticker!, duration: duration ?? defaultAnimationDuration); final offsetTween = Tween(begin: _gsTopLeftOffset, end: offset); final scaleTween = Tween(begin: _scale, end: scale);