handleScrollNotification method
Reads a scroll notification from the attached scrollable.
The decision reads each ScrollUpdateNotification after the scroll has moved, so input that announces its direction before it moves (the mouse wheel does) cannot be mistaken for a reader still at the end. Moves made by this edge are ignored.
Implementation
void handleScrollNotification(ScrollNotification notification) {
if (!_programmatic && notification is ScrollUpdateNotification) {
final delta = notification.scrollDelta ?? 0;
final distance = _distanceToEnd(notification.metrics);
if (distance <= _atEnd) {
_setFollowing(true);
} else if (delta < 0) {
_setFollowing(false);
} else if (delta > 0 && distance <= _threshold) {
_setFollowing(true);
}
}
_lastMaxScrollExtent = notification.metrics.maxScrollExtent;
_refreshLatest(notification.metrics);
}