Jaime Blasco

Not listen to horizontal scroll updates

@@ -244,17 +244,19 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> @@ -244,17 +244,19 @@ class _ModalBottomSheetState extends State<ModalBottomSheet>
244 DateTime _startTime; 244 DateTime _startTime;
245 245
246 void _handleScrollUpdate(ScrollNotification notification) { 246 void _handleScrollUpdate(ScrollNotification notification) {
247 -  
248 final scrollPosition = _scrollController.position; 247 final scrollPosition = _scrollController.position;
249 248
  249 + if (scrollPosition.axis == Axis.horizontal) return;
  250 +
  251 + //Check if scrollController is used
  252 + if (!_scrollController.hasClients) return;
  253 +
250 final isScrollReversed = scrollPosition.axisDirection == AxisDirection.down; 254 final isScrollReversed = scrollPosition.axisDirection == AxisDirection.down;
251 final offset = isScrollReversed 255 final offset = isScrollReversed
252 ? scrollPosition.pixels 256 ? scrollPosition.pixels
253 : scrollPosition.maxScrollExtent - scrollPosition.pixels; 257 : scrollPosition.maxScrollExtent - scrollPosition.pixels;
254 258
255 if (offset <= 0) { 259 if (offset <= 0) {
256 - //Check if scrollController is used  
257 - if (!_scrollController.hasClients) return;  
258 // Check if listener is same from scrollController. 260 // Check if listener is same from scrollController.
259 // TODO: Improve the way it checks if it the same view controller 261 // TODO: Improve the way it checks if it the same view controller
260 // Use PrimaryScrollController 262 // Use PrimaryScrollController