Showing
1 changed file
with
12 additions
and
8 deletions
| @@ -49,7 +49,7 @@ class ModalBottomSheet extends StatefulWidget { | @@ -49,7 +49,7 @@ class ModalBottomSheet extends StatefulWidget { | ||
| 49 | required this.expanded, | 49 | required this.expanded, |
| 50 | required this.onClosing, | 50 | required this.onClosing, |
| 51 | required this.child, | 51 | required this.child, |
| 52 | - }) : assert(enableDrag != null), | 52 | + }) : assert(enableDrag != null), |
| 53 | assert(onClosing != null), | 53 | assert(onClosing != null), |
| 54 | assert(child != null), | 54 | assert(child != null), |
| 55 | super(key: key); | 55 | super(key: key); |
| @@ -265,14 +265,18 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -265,14 +265,18 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
| 265 | assert(notification.context != null); | 265 | assert(notification.context != null); |
| 266 | //Check if scrollController is used | 266 | //Check if scrollController is used |
| 267 | if (!_scrollController.hasClients) return; | 267 | if (!_scrollController.hasClients) return; |
| 268 | - //Check if there is more than 1 attached ScrollController e.g. swiping page in PageView | ||
| 269 | - // ignore: invalid_use_of_protected_member | ||
| 270 | - if (_scrollController.positions.length > 1) return; | ||
| 271 | - | ||
| 272 | - if (_scrollController != | ||
| 273 | - Scrollable.of(notification.context!)!.widget.controller) return; | ||
| 274 | 268 | ||
| 275 | - final scrollPosition = _scrollController.position; | 269 | + ScrollPosition scrollPosition; |
| 270 | + // ignore: invalid_use_of_protected_member | ||
| 271 | + if (_scrollController.positions.length > 1) { | ||
| 272 | + // ignore: invalid_use_of_protected_member | ||
| 273 | + scrollPosition = _scrollController.positions | ||
| 274 | + .firstWhere((p) => p.isScrollingNotifier.value, | ||
| 275 | + // ignore: invalid_use_of_protected_member | ||
| 276 | + orElse: () => _scrollController.positions.first); | ||
| 277 | + } else { | ||
| 278 | + scrollPosition = _scrollController.position; | ||
| 279 | + } | ||
| 276 | 280 | ||
| 277 | if (scrollPosition.axis == Axis.horizontal) return; | 281 | if (scrollPosition.axis == Axis.horizontal) return; |
| 278 | 282 |
-
Please register or login to post a comment