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 scroll in upperLayer when state is not AnimationState.expanded #39

Open
mehdok opened this issue Jul 14, 2019 · 2 comments
Open

Comments

@mehdok
Copy link

mehdok commented Jul 14, 2019

i'm using a ListView for my upperLayer. When the AnimationState is half_expanded or collapsed i can scroll the ListView. I need to disable the scroll in this states and just enable it in expanded. How can i achieve this?

@japborst
Copy link

You can achieve this by using passing a scrollController to the RubberBottomSheet and setting the same scrollController in the listView, along with NeverScrollablePhysics.

See https://github.com/mcrovero/rubber/wiki/Scrolling for a full example.

@jeffsieu
Copy link

jeffsieu commented Jan 2, 2021

There is a bug in this, where scrolling the ListView is still possible, even when the sheet is in a collapsed state. This happens when the sheet is programmatically collapsed via collapse or fling, and when the scrollOffset of the list is programatically set to 0, from a non-zero value.

In my app, I allow users to scroll up and down the ListView, but pressing a button will collapse the bottom sheet to reveal another widget underneath the sheet. As such, I programmatically set the scroll offset using jumpTo(0), and collapse the bottom sheet with fling. RubberBottomSheet toggles between scrolling of the ListView and dragging of the sheet in RubberBottomSheet._onVerticalDragUpdate, using the _setScrolling function. It decides this based on the scrollPosition of the scrollController passed into the constructor. Hence, it is not able to detect that it's supposed to drag the sheet instead of scrolling the ListView, when the ListView is programmatically scrolled to the top.

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

3 participants