updateGeometry method Null safety

  1. @protected
double updateGeometry()

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 && _childPosition == 0.0) {
    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: paintExtent.clamp(0.0, constraints.remainingPaintExtent),
    layoutExtent: layoutExtent.clamp(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);
}