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

updated horizontal scrolling inside bs #6

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ottodaempfle
Copy link
Collaborator

Updated horizontal scrolling

Copy link
Member

@JulianBissekkou JulianBissekkou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only small docs things, everything else is quite cool and works nice!

Comment on lines +135 to +155
return NotificationListener(
onNotification: (scrollNotification) {
if (scrollNotification is ScrollStartNotification &&
scrollNotification.metrics.axis == Axis.horizontal) {
_isHorizontalScrolling = true;
}

if (scrollNotification is ScrollUpdateNotification &&
scrollNotification.metrics.axis == Axis.horizontal) {
if (scrollNotification.dragDetails == null) {
_isHorizontalScrolling = false;
}
}

if (scrollNotification is ScrollEndNotification &&
scrollNotification.metrics.axis == Axis.horizontal) {
_isHorizontalScrolling = false;
}

return false;
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some docs to this section because the bottom sheet is already complex :S
You can take the parts that you like.

    return NotificationListener<ScrollNotification>(
      // Disable vertical scrolling when the user is scrolling in a nested
      // horizontal scroll view. Otherwise we should slightly move the bottom
      // sheet vertically up and down which feels buggy.
      onNotification: (notification) {
        if (notification.metrics.axis != Axis.horizontal) {
          return false;
        }

        if (notification is ScrollStartNotification) {
          _isHorizontalScrolling = true;
        }
        if (notification is ScrollEndNotification) {
          _isHorizontalScrolling = false;
        }

        // Drag details are null if the user started a scroll and the
        // scrollview is continue to scroll without the user touching the view.
        if (notification is ScrollUpdateNotification &&
            notification.dragDetails == null) {
          _isHorizontalScrolling = false;
        }

        return false;
      },

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

Successfully merging this pull request may close these issues.

2 participants