RenderSliverListLayout constructor

RenderSliverListLayout({
  1. required CSSRenderStyle renderStyle,
  2. required RenderSliverElementChildManager manager,
  3. ScrollListener? onScroll,
})

Implementation

RenderSliverListLayout({
  required CSSRenderStyle renderStyle,
  required RenderSliverElementChildManager manager,
  ScrollListener? onScroll,
}) : _renderSliverBoxChildManager = manager,
     _scrollListener = onScroll,
      super(renderStyle: renderStyle) {
  scrollable = KrakenScrollable(axisDirection: getAxisDirection(axis));
  axis = renderStyle.sliverDirection;

  switch (axis) {
    case Axis.horizontal:
      scrollOffsetX = scrollable.position;
      scrollOffsetY = null;
      break;
    case Axis.vertical:
      scrollOffsetX = null;
      scrollOffsetY = scrollable.position;
      break;
  }

  RenderSliverList renderSliverList = _renderSliverList = _buildRenderSliverList();
  _renderViewport = RenderViewport(
    offset: scrollable.position!,
    axisDirection: scrollable.axisDirection,
    crossAxisDirection: getCrossAxisDirection(axis),
    children: [renderSliverList],
  );
  manager.setupSliverListLayout(this);
  super.insert(_renderViewport);
}