Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable drag down to close showModalBottomSheet

How do I disable / escape drag down gesture within the Bottom Sheet Modal so the user can interact within the modal without accidentally closing the modal?

Updated below with the actual modal bottom sheet.

return showModalBottomSheet(
    context: context,
    builder: (BuildContext context) {
        ...
    }
}
like image 756
Jesse Avatar asked Feb 18 '19 08:02

Jesse


People also ask

What is a modal bottom sheet?

Modal bottom sheets present a set of choices while blocking interaction with the rest of the screen.

What is bottom sheet in flutter?

Modal Bottom Sheet is an alternative to a menu or a dialog and prevents the user from interacting with the rest of the app. It will appear over the UI so that there is no need to navigate to a different page. It can be used to perform a small task that does not require the whole new screen to be built.


1 Answers

Set enableDrag to false

bool enableDrag

If true, the bottom sheet can dragged up and down and dismissed by swiping downwards.

https://docs.flutter.io/flutter/material/BottomSheet/enableDrag.html

like image 135
Willy Avatar answered Oct 05 '22 00:10

Willy