ScrollView constructor

const ScrollView({Key key, Axis scrollDirection: Axis.vertical, bool reverse: false, ScrollController controller, bool primary, ScrollPhysics physics, bool shrinkWrap: false, Key center, double anchor: 0.0, double cacheExtent, int semanticChildCount, DragStartBehavior dragStartBehavior: DragStartBehavior.start })

Creates a widget that scrolls.

If the primary argument is true, the controller must be null.

If the shrinkWrap argument is true, the center argument must be null.

The scrollDirection, reverse, and shrinkWrap arguments must not be null.

The anchor argument must be non-null and in the range 0.0 to 1.0.

Implementation

const ScrollView({
  Key key,
  this.scrollDirection = Axis.vertical,
  this.reverse = false,
  this.controller,
  bool primary,
  ScrollPhysics physics,
  this.shrinkWrap = false,
  this.center,
  this.anchor = 0.0,
  this.cacheExtent,
  this.semanticChildCount,
  this.dragStartBehavior = DragStartBehavior.start,
}) : assert(scrollDirection != null),
     assert(reverse != null),
     assert(shrinkWrap != null),
     assert(dragStartBehavior != null),
     assert(!(controller != null && primary == true),
         'Primary ScrollViews obtain their ScrollController via inheritance from a PrimaryScrollController widget. '
         'You cannot both set primary to true and pass an explicit controller.'
     ),
     assert(!shrinkWrap || center == null),
     assert(anchor != null),
     assert(anchor >= 0.0 && anchor <= 1.0),
     primary = primary ?? controller == null && identical(scrollDirection, Axis.vertical),
     physics = physics ?? (primary == true || (primary == null && controller == null && identical(scrollDirection, Axis.vertical)) ? const AlwaysScrollableScrollPhysics() : null),
     super(key: key);