RenderTwoDimensionalViewport constructor
- required ViewportOffset horizontalOffset,
- required AxisDirection horizontalAxisDirection,
- required ViewportOffset verticalOffset,
- required AxisDirection verticalAxisDirection,
- required TwoDimensionalChildDelegate delegate,
- required Axis mainAxis,
- required TwoDimensionalChildManager childManager,
- @Deprecated('Use scrollCacheExtent instead. ' 'This feature was deprecated after v3.41.0-0.0.pre.') double? cacheExtent,
- @Deprecated('Use scrollCacheExtent instead. ' 'This feature was deprecated after v3.41.0-0.0.pre.') CacheExtentStyle? cacheExtentStyle,
- ScrollCacheExtent? scrollCacheExtent,
- Clip clipBehavior = Clip.hardEdge,
Initializes fields for subclasses.
The cacheExtent, if null, defaults to
RenderAbstractViewport.defaultCacheExtent.
Implementation
RenderTwoDimensionalViewport({
required this._horizontalOffset,
required AxisDirection horizontalAxisDirection,
required this._verticalOffset,
required AxisDirection verticalAxisDirection,
required this._delegate,
required this._mainAxis,
required this._childManager,
@Deprecated(
'Use scrollCacheExtent instead. '
'This feature was deprecated after v3.41.0-0.0.pre.',
)
double? cacheExtent,
@Deprecated(
'Use scrollCacheExtent instead. '
'This feature was deprecated after v3.41.0-0.0.pre.',
)
CacheExtentStyle? cacheExtentStyle,
ScrollCacheExtent? scrollCacheExtent,
this._clipBehavior = Clip.hardEdge,
}) : assert(
verticalAxisDirection == AxisDirection.down || verticalAxisDirection == AxisDirection.up,
'TwoDimensionalViewport.verticalAxisDirection is not Axis.vertical.',
),
assert(
horizontalAxisDirection == AxisDirection.left ||
horizontalAxisDirection == AxisDirection.right,
'TwoDimensionalViewport.horizontalAxisDirection is not Axis.horizontal.',
),
_horizontalAxisDirection = horizontalAxisDirection,
_verticalAxisDirection = verticalAxisDirection,
_scrollCacheExtent =
scrollCacheExtent ??
(cacheExtent != null
? switch (cacheExtentStyle) {
CacheExtentStyle.pixel || null => ScrollCacheExtent.pixels(cacheExtent),
CacheExtentStyle.viewport => ScrollCacheExtent.viewport(cacheExtent),
}
: const ScrollCacheExtent.pixels(RenderAbstractViewport.defaultCacheExtent)) {
assert(() {
_debugDanglingKeepAlives = <RenderBox>[];
return true;
}());
}