updateRenderBoxModelWithOverflowY method
void
updateRenderBoxModelWithOverflowY(
- ScrollListener scrollListener
)
Implementation
void updateRenderBoxModelWithOverflowY(ScrollListener scrollListener) {
if (renderBoxModel is RenderSliverListLayout) {
RenderSliverListLayout renderBoxModel = this.renderBoxModel as RenderSliverListLayout;
renderBoxModel.scrollOffsetY = renderBoxModel.axis == Axis.vertical ? renderBoxModel.scrollable.position : null;
} else if (renderBoxModel != null) {
RenderBoxModel renderBoxModel = this.renderBoxModel!;
CSSOverflowType overflowY = renderStyle.effectiveOverflowY;
switch (overflowY) {
case CSSOverflowType.clip:
_scrollableY = null;
break;
case CSSOverflowType.hidden:
case CSSOverflowType.auto:
case CSSOverflowType.scroll:
// If the render has been offset when previous overflow is auto or scroll, _scrollableY should not reset.
if (_scrollableY == null) {
_scrollableY = WebFScrollable(
axisDirection: AxisDirection.down,
scrollListener: scrollListener,
overflowType: overflowY,
currentView: renderStyle.currentFlutterView);
renderBoxModel.scrollOffsetY = _scrollableY!.position;
}
// Reset canDrag by overflow because hidden is can't drag.
bool canDrag = overflowY != CSSOverflowType.hidden;
_scrollableY!.overflowType = overflowY;
_scrollableY!.setCanDrag(canDrag);
break;
case CSSOverflowType.visible:
default:
_scrollableY = null;
break;
}
renderBoxModel.scrollListener = scrollListener;
renderBoxModel.scrollablePointerListener = _scrollablePointerListener;
}
}