RenderViewport constructor
- AxisDirection axisDirection = AxisDirection.down,
- required AxisDirection crossAxisDirection,
- required ViewportOffset offset,
- double anchor = 0.0,
- List<
RenderSliver> ? children, - RenderSliver? center,
- double? cacheExtent,
- CacheExtentStyle cacheExtentStyle = CacheExtentStyle.pixel,
- Clip clipBehavior = Clip.hardEdge,
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
ViewportOffset.zero or ViewportOffset.fixed.
Implementation
RenderViewport({
super.axisDirection,
required super.crossAxisDirection,
required super.offset,
double anchor = 0.0,
List<RenderSliver>? children,
RenderSliver? center,
super.cacheExtent,
super.cacheExtentStyle,
super.clipBehavior,
}) : assert(anchor >= 0.0 && anchor <= 1.0),
assert(cacheExtentStyle != CacheExtentStyle.viewport || cacheExtent != null),
_anchor = anchor,
_center = center {
addAll(children);
if (center == null && firstChild != null) {
_center = firstChild;
}
}