updateGeometry method Null safety

  1. @protected
double updateGeometry()
protected">@protected

Updates geometry, and returns the new value for childMainAxisPosition.

This is used by performLayout.

Implementation

@protected
double updateGeometry() {
  double stretchOffset = 0.0;
  if (stretchConfiguration != null) {
    stretchOffset += constraints.overlap.abs();
  }
  final double maxExtent = this.maxExtent;
  final double paintExtent = maxExtent - _effectiveScrollOffset!;
  final double layoutExtent = maxExtent - constraints.scrollOffset;
  geometry = SliverGeometry(
    scrollExtent: maxExtent,
    paintOrigin: math.min(constraints.overlap, 0.0),
    paintExtent: clampDouble(paintExtent, 0.0, constraints.remainingPaintExtent),
    layoutExtent: clampDouble(layoutExtent, 0.0, constraints.remainingPaintExtent),
    maxPaintExtent: maxExtent + stretchOffset,
    hasVisualOverflow: true, // Conservatively say we do have overflow to avoid complexity.
  );
  return stretchOffset > 0 ? 0.0 : math.min(0.0, paintExtent - childExtent);
}