updateHorizontalOffset method

void updateHorizontalOffset(
  1. ViewportOffset offset
)

Updates the horizontal scroll offset controller.

Replaces the current horizontal offset with a new one, properly managing listeners to ensure scroll changes trigger updates.

Implementation

void updateHorizontalOffset(ViewportOffset offset) {
  if (horizontal != offset) {
    horizontal.removeListener(_onScrollOffsetChanged);
    horizontal = offset;
    if (attached) {
      horizontal.addListener(_onScrollOffsetChanged);
    }
  }
}