Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable SheetPage closing with mouse wheel #418

Open
passsy opened this issue Jul 22, 2024 · 1 comment
Open

Disable SheetPage closing with mouse wheel #418

passsy opened this issue Jul 22, 2024 · 1 comment

Comments

@passsy
Copy link

passsy commented Jul 22, 2024

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
Copy link
Author

passsy commented Jul 24, 2024

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,
          ),
        );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant