attach method
Implementation
void attach(ScrollPosition position) {
assert(!_positionToListener.containsKey(position));
if (_positionToListener.isNotEmpty) {
final ScrollPosition otherScrollPosition = _positionToListener.keys.first;
final double pixels = otherScrollPosition.pixels;
if (position.pixels != pixels) {
position.correctPixels(pixels);
position.applyViewportDimension(otherScrollPosition.viewportDimension);
position.applyContentDimensions(
otherScrollPosition.minScrollExtent,
otherScrollPosition.maxScrollExtent,
);
}
final ScrollActivity? activity = otherScrollPosition.activity;
if (activity != null &&
activity.isScrolling &&
activity is BallisticScrollActivity) {
position.activity?.delegate.goBallistic(activity.velocity);
}
}
_positionToListener[position] = DragHoldController(position);
}