RenderViewportBase<ParentDataClass extends ContainerParentDataMixin<RenderSliver>> constructor

RenderViewportBase<ParentDataClass extends ContainerParentDataMixin<RenderSliver>>({
  1. AxisDirection axisDirection = AxisDirection.down,
  2. required AxisDirection crossAxisDirection,
  3. required ViewportOffset offset,
  4. @Deprecated('Use scrollCacheExtent instead. ' 'This feature was deprecated after v3.41.0-0.0.pre.') double? cacheExtent,
  5. @Deprecated('Use scrollCacheExtent instead. ' 'This feature was deprecated after v3.41.0-0.0.pre.') CacheExtentStyle cacheExtentStyle = CacheExtentStyle.pixel,
  6. ScrollCacheExtent? scrollCacheExtent,
  7. SliverPaintOrder paintOrder = SliverPaintOrder.firstIsTop,
  8. Clip clipBehavior = Clip.hardEdge,
})

Initializes fields for subclasses.

The scrollCacheExtent sets the amount of scrollable content that is cached.

Implementation

RenderViewportBase({
  AxisDirection axisDirection = AxisDirection.down,
  required AxisDirection crossAxisDirection,
  required ViewportOffset offset,
  @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 = CacheExtentStyle.pixel,
  ScrollCacheExtent? scrollCacheExtent,
  SliverPaintOrder paintOrder = SliverPaintOrder.firstIsTop,
  Clip clipBehavior = Clip.hardEdge,
}) : assert(axisDirectionToAxis(axisDirection) != axisDirectionToAxis(crossAxisDirection)),
     assert(cacheExtent != null || cacheExtentStyle == CacheExtentStyle.pixel),
     _axisDirection = axisDirection,
     _crossAxisDirection = crossAxisDirection,
     _offset = offset,
     _scrollCacheExtent =
         scrollCacheExtent ??
         switch (cacheExtentStyle) {
           CacheExtentStyle.pixel => ScrollCacheExtent.pixels(
             cacheExtent ?? RenderAbstractViewport.defaultCacheExtent,
           ),
           CacheExtentStyle.viewport => ScrollCacheExtent.viewport(cacheExtent!),
         },
     _paintOrder = paintOrder,
     _clipBehavior = clipBehavior;