setViewportHeight method

bool setViewportHeight(
  1. int height
)

Updates the viewport height and clamps offset if needed.

Implementation

bool setViewportHeight(int height) {
  if (height < 0) height = 0;
  if (_viewportHeight == height) return false;
  final beforeHeight = _viewportHeight;
  final beforeOffset = _offset;
  _viewportHeight = height;
  final clamped = _clampOffset();
  _traceScroll(
    'list_view.metrics.viewport '
    'view=$beforeHeight->$_viewportHeight '
    'offset=$beforeOffset->$_offset max=$maxOffset clamped=$clamped',
  );
  return clamped;
}