updateGeometry method

  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) {
    stretchOffset += constraints.overlap.abs();
  }
  final double maxExtent = this.maxExtent;
  final double paintExtent = maxExtent - constraints.scrollOffset;
  final double cacheExtent = calculateCacheOffset(
    constraints,
    from: 0.0,
    to: maxExtent,
  );

  geometry = SliverGeometry(
    cacheExtent: cacheExtent,
    scrollExtent: maxExtent,
    paintOrigin: math.min(constraints.overlap, 0.0),
    paintExtent: clampDouble(paintExtent, 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);
}