Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled Exception: 'package:flutter/src/widgets/scroll_controller.dart': Failed assertion: line 201 pos 12: '_positions.isNotEmpty': ScrollController not attached to any scroll views. #399

Open
HaelArena opened this issue Apr 29, 2024 · 3 comments

Comments

@HaelArena
Copy link

GestureDetector(
onLongPressUp: () {
showCupertinoModalBottomSheet(
isDismissible: true,
backgroundColor: lightBlackNavBar,
useRootNavigator: true,
context: context,
duration: Duration(milliseconds: 200),
builder: (context) => Container(
height: 300,
child: Center(child: Text('I tuoi account')),
),
);
},

I'm trying to open the bottom modal sheet but when I tap outside to dismiss the bottom sheet it throws the error:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:flutter/src/widgets/scroll_controller.dart': Failed assertion: line 201 pos 12: '_positions.isNotEmpty': ScrollController not attached to any scroll views.
#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
#2 ScrollController.animateTo (package:flutter/src/widgets/scroll_controller.dart:201:12)
#3 ModalBottomSheetState.build. (package:modal_bottom_sheet/src/bottom_sheet.dart:417:27)
#4 _StatusBarGestureDetectorState.build.. (package:modal_bottom_sheet/src/utils/scroll_to_top_status_bar.dart:47:40)
#5 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:315:24)
#6 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:652:11)
#7 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/t<…>

@manhhaiphp
Copy link

I got the same error when clicking on top outside SafeArea

@linhkiubo98
Copy link

GestureDetector( onLongPressUp: () { showCupertinoModalBottomSheet( isDismissible: true, backgroundColor: lightBlackNavBar, useRootNavigator: true, context: context, duration: Duration(milliseconds: 200), builder: (context) => Container( height: 300, child: Center(child: Text('I tuoi account')), ), ); },

I'm trying to open the bottom modal sheet but when I tap outside to dismiss the bottom sheet it throws the error:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:flutter/src/widgets/scroll_controller.dart': Failed assertion: line 201 pos 12: '_positions.isNotEmpty': ScrollController not attached to any scroll views. #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61) #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5) #2 ScrollController.animateTo (package:flutter/src/widgets/scroll_controller.dart:201:12) #3 ModalBottomSheetState.build. (package:modal_bottom_sheet/src/bottom_sheet.dart:417:27) #4 _StatusBarGestureDetectorState.build.. (package:modal_bottom_sheet/src/utils/scroll_to_top_status_bar.dart:47:40) #5 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:315:24) #6 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:652:11) #7 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/t<…>

Do you have any solution?

@linhkiubo98
Copy link

I got the same error when clicking on top outside SafeArea

Do you have any solution for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants