setHorizontalMargins method

void setHorizontalMargins(
  1. int left,
  2. int right
)

Sets the horizontal scrolling margin to left and right. Both values must be between 0 and viewWidth - 1.

Implementation

void setHorizontalMargins(int left, int right) {
  final effectiveLeft = left.clamp(0, viewWidth - 1);
  final effectiveRight = right.clamp(0, viewWidth - 1);
  if (effectiveLeft >= effectiveRight) return;

  _marginLeft = effectiveLeft;
  _marginRight = effectiveRight;
}