From 1f96c6a63c432ec3e32bd33d6313633ccdc94fb1 Mon Sep 17 00:00:00 2001 From: Stefan Schaller Date: Thu, 14 Mar 2024 08:34:27 +0100 Subject: [PATCH] fix canDrag --- lib/scrollable_bottom_sheet.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/scrollable_bottom_sheet.dart b/lib/scrollable_bottom_sheet.dart index 00130bc..f4b3527 100644 --- a/lib/scrollable_bottom_sheet.dart +++ b/lib/scrollable_bottom_sheet.dart @@ -63,7 +63,7 @@ class ScrollableBottomSheet extends StatefulWidget { class ScrollableBottomSheetState extends State with SingleTickerProviderStateMixin { final _scrollController = ScrollController(); - late AnimationController _animationController; + late final AnimationController _animationController; var _isScrollingEnabled = false; var _isScrollingBlocked = false; @@ -202,6 +202,10 @@ class ScrollableBottomSheetState extends State // region animation and scroll void _onScroll() { + // No need to do anything when [canDrag] is disabled, since the list scrolls + // by default without any calls from our implementation. + if (!widget.canDrag) return; + if (!_isScrollingEnabled || _isScrollingBlocked) { _scrollController.jumpTo(0); }