modal_bottom_sheet icon indicating copy to clipboard operation
modal_bottom_sheet copied to clipboard

Disable SheetPage closing with mouse wheel

Open passsy opened this issue 1 year ago • 1 comments
trafficstars

I hava a SheetPage with a SingleChildScrollView on macos.

Actual: When I'm at the top, and drag down using my finger (overscroll), nothing happens. When I'm at the top, and scroll down using my mouse scroll wheel, the bottom sheet closes.

Expected: When I'm at the top, and scroll down using my mouse scroll wheel, nothing happens.

passsy avatar Jul 22 '24 00:07 passsy

My current workaround

class MySheetPage<T> extends SheetPage<T> {
  MySheetPage({
    required Widget child,
  }) : super(
          child: Listener(
            behavior: HitTestBehavior.translucent,
            onPointerSignal: (signal) {
              if (signal is PointerScrollEvent) {
                GestureBinding.instance.pointerSignalResolver.register(signal, (PointerSignalEvent event) {
                  // intercept mouse wheel scroll events, to prevent the mouse wheel from closing the SheetPage
                  // https://github.com/jamesblasco/modal_bottom_sheet/issues/418
                });
              }
            },
            child: child,
          ),
        );
}

passsy avatar Jul 24 '24 21:07 passsy