ScrollView constructor

ScrollView({Key key, Axis scrollDirection: Axis.vertical, bool reverse: false, ScrollController controller, bool primary, ScrollPhysics physics, bool shrinkWrap: false, double cacheExtent, int semanticChildCount })

Creates a widget that scrolls.

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

Implementation

ScrollView({ // ignore: prefer_const_constructors_in_immutables
             // TODO(aam): Remove lint ignore above once dartbug.com/34297 is fixed
  Key key,
  this.scrollDirection = Axis.vertical,
  this.reverse = false,
  this.controller,
  bool primary,
  ScrollPhysics physics,
  this.shrinkWrap = false,
  this.cacheExtent,
  this.semanticChildCount,
}) : assert(reverse != null),
     assert(shrinkWrap != 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.'
     ),
     primary = primary ?? controller == null && scrollDirection == Axis.vertical,
     physics = physics ?? (primary == true || (primary == null && controller == null && scrollDirection == Axis.vertical) ? const AlwaysScrollableScrollPhysics() : null),
     super(key: key);