modal_bottom_sheet
modal_bottom_sheet copied to clipboard
Disable SheetPage closing with mouse wheel
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.
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,
),
);
}