-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Conversation
… into fix-horizontal-scroll
There was a problem hiding this 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!
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; | ||
}, |
There was a problem hiding this comment.
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;
},
Updated horizontal scrolling