modal_bottom_sheet icon indicating copy to clipboard operation
modal_bottom_sheet copied to clipboard

On navigator.pop (not an issue)

Open spacekestrel opened this issue 4 years ago • 1 comments

Is there a way to detect whether ModalBottomSheet is closed by tapping on the rest of the screen? I need to invoke some functions on this moment.

spacekestrel avatar Jul 24 '21 19:07 spacekestrel

You can wrap you modal widget in a WillPopScope:

WillPopScope(
      onWillPop: () async {
        // TODO
      },
      child: Scaffold(
        // ...
     )
)

However, this will not differentiate between closing the modal by tapping outside of it and dragging it down. Maybe this helps.

JulianAssmann avatar Aug 31 '21 16:08 JulianAssmann