jamesblasco / modal_bottom_sheet

Flutter | Create advanced modal bottom sheets. Material, Cupertino or your own style
https://pub.dev/packages/modal_bottom_sheet
MIT License
1.83k stars 461 forks source link

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 2 months ago

HaelArena commented 2 months ago

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 commented 1 month ago

I got the same error when clicking on top outside SafeArea