updateRenderBoxModelWithOverflowX method

void updateRenderBoxModelWithOverflowX(
  1. ScrollListener scrollListener
)
inherited

Implementation

void updateRenderBoxModelWithOverflowX(ScrollListener scrollListener) {
  if (renderBoxModel is RenderSliverListLayout) {
    RenderSliverListLayout renderBoxModel = this.renderBoxModel as RenderSliverListLayout;
    renderBoxModel.scrollOffsetX = renderBoxModel.axis == Axis.horizontal
        ? renderBoxModel.scrollable.position : null;
  } else if (renderBoxModel != null) {
    RenderBoxModel renderBoxModel = this.renderBoxModel!;
    CSSOverflowType overflowX = renderStyle.effectiveOverflowX;
    switch(overflowX) {
      case CSSOverflowType.hidden:
        // @TODO: Content of overflow hidden can be scrolled programmatically.
        _scrollableX = null;
        break;
      case CSSOverflowType.clip:
        _scrollableX = null;
        break;
      case CSSOverflowType.auto:
      case CSSOverflowType.scroll:
        _scrollableX = KrakenScrollable(axisDirection: AxisDirection.right, scrollListener: scrollListener);
        renderBoxModel.scrollOffsetX = _scrollableX!.position;
        break;
      case CSSOverflowType.visible:
      default:
        _scrollableX = null;
        break;
    }

    renderBoxModel.scrollListener = scrollListener;
    renderBoxModel.scrollablePointerListener = _scrollablePointerListener;
  }
}