handleScrollMetrics method
Reads new extents from the attached scrollable.
Content that shrank while the reader was within threshold of the end follows again. A following scrollable left short of its end (a recreated scroll position skips the physics on its first layout) moves to it after the frame.
Implementation
void handleScrollMetrics(ScrollMetrics metrics) {
final previous = _lastMaxScrollExtent;
_lastMaxScrollExtent = metrics.maxScrollExtent;
if (!_following &&
_enabled &&
previous != null &&
metrics.maxScrollExtent < previous - _atEnd &&
_distanceToEnd(metrics) <= _threshold) {
_setFollowing(true);
}
if (keepsEnd && !_returning && _distanceToEnd(metrics) > _atEnd) {
_scheduleFollow();
}
_refreshLatest(metrics);
}