layoutChild method

double? layoutChild(
  1. RenderBox child,
  2. BoxConstraints childConstraints, {
  3. RenderBox? lastChildWithScrollOffset,
})

Implementation

double? layoutChild(
  RenderBox child,
  BoxConstraints childConstraints, {
  RenderBox? lastChildWithScrollOffset,
}) {
  if (childScrollOffset(child) == null && lastChildWithScrollOffset == null) {
    return null;
  }
  if (childScrollOffset(child) == null) {
    final data = child.parentData! as SliverMultiBoxAdaptorParentData;
    data.layoutOffset =
        childScrollOffset(lastChildWithScrollOffset!)! +
        paintExtentOf(lastChildWithScrollOffset);
  }
  child.layout(childConstraints, parentUsesSize: true);
  final index = indexOf(child);
  _extentManager.setExtent(index, paintExtentOf(child));
  final nextChild = childAfter(child);
  if (nextChild != null) {
    final nextChildData =
        nextChild.parentData! as SliverMultiBoxAdaptorParentData;
    nextChildData.layoutOffset = null;
  }
  return childScrollOffset(child);
}