ScrollPosition constructor

ScrollPosition({
  1. required ScrollPhysics physics,
  2. required ScrollContext context,
  3. bool keepScrollOffset = true,
  4. ScrollPosition? oldPosition,
  5. String? debugLabel,
})

Creates an object that determines which portion of the content is visible in a scroll view.

Implementation

ScrollPosition({
  required this.physics,
  required this.context,
  this.keepScrollOffset = true,
  ScrollPosition? oldPosition,
  this.debugLabel,
}) {
  if (oldPosition != null) {
    absorb(oldPosition);
  }
  if (keepScrollOffset) {
    restoreScrollOffset();
  }
}