Fix "ScrollController not attached to any scroll views" issue
Showing
1 changed file
with
3 additions
and
2 deletions
@@ -258,12 +258,13 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -258,12 +258,13 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
258 | DateTime _startTime; | 258 | DateTime _startTime; |
259 | 259 | ||
260 | void _handleScrollUpdate(ScrollNotification notification) { | 260 | void _handleScrollUpdate(ScrollNotification notification) { |
261 | + //Check if scrollController is used | ||
262 | + if (!_scrollController.hasClients) return; | ||
263 | + | ||
261 | final scrollPosition = _scrollController.position; | 264 | final scrollPosition = _scrollController.position; |
262 | 265 | ||
263 | if (scrollPosition.axis == Axis.horizontal) return; | 266 | if (scrollPosition.axis == Axis.horizontal) return; |
264 | 267 | ||
265 | - //Check if scrollController is used | ||
266 | - if (!_scrollController.hasClients) return; | ||
267 | 268 | ||
268 | final isScrollReversed = scrollPosition.axisDirection == AxisDirection.down; | 269 | final isScrollReversed = scrollPosition.axisDirection == AxisDirection.down; |
269 | final offset = isScrollReversed | 270 | final offset = isScrollReversed |
-
Please register or login to post a comment