getLayoutPass method

LayoutPass? getLayoutPass(
  1. RenderSuperSliverList self
)

Implementation

LayoutPass? getLayoutPass(RenderSuperSliverList self) {
  final viewport = getViewport();
  if (viewport == null) {
    return null;
  }
  var pass = _viewportToLayoutPass[viewport];
  if (pass == null) {
    final slivers = getSuperSliverLists();
    var sliverWithOffsetEstimation = slivers.firstWhereOrNull(
      (element) => element.hasChildScrollOffsetEstimation,
    );
    if (sliverWithOffsetEstimation != null) {
      sliverWithOffsetEstimation.sanitizeChildScrollOffsetEstimation(
        viewport,
      );
      if (!sliverWithOffsetEstimation.hasChildScrollOffsetEstimation) {
        sliverWithOffsetEstimation = null;
      }
    }
    pass = LayoutPass(
      slivers: slivers,
      initialScrollPosition: viewport.offset.pixels,
      childScrollOffsetEstimation: sliverWithOffsetEstimation != null,
      sliverWithOffsetEstimation: sliverWithOffsetEstimation,
    );
    _viewportToLayoutPass[viewport] = pass;
    Future.microtask(() {
      _viewportToLayoutPass[viewport] = null;
    });
  }
  if (!pass.sliversDuringLayout.contains(self)) {
    pass.sliversDuringLayout.add(self);
  }
  return pass;
}