RenderViewport constructor

RenderViewport({AxisDirection axisDirection: AxisDirection.down, @required AxisDirection crossAxisDirection, @required ViewportOffset offset, double anchor: 0.0, List<RenderSliver> children, RenderSliver center, double cacheExtent })

Creates a viewport for RenderSliver objects.

If the center is not specified, then the first child in the children list, if any, is used.

The offset must be specified. For testing purposes, consider passing a new ViewportOffset.zero or new ViewportOffset.fixed.

Implementation

RenderViewport({
  AxisDirection axisDirection = AxisDirection.down,
  @required AxisDirection crossAxisDirection,
  @required ViewportOffset offset,
  double anchor = 0.0,
  List<RenderSliver> children,
  RenderSliver center,
  double cacheExtent,
}) : assert(anchor != null),
     assert(anchor >= 0.0 && anchor <= 1.0),
     _anchor = anchor,
     _center = center,
     super(axisDirection: axisDirection, crossAxisDirection: crossAxisDirection, offset: offset, cacheExtent: cacheExtent) {
  addAll(children);
  if (center == null && firstChild != null)
    _center = firstChild;
}