moveByOffset method

bool moveByOffset(
  1. double offset
)

Move forward or backward by a number of elements determined by pixel offset.

If offset is negative, move backward; otherwise move forward.

Returns true and updates current if successful.

Implementation

bool moveByOffset(double offset) {
  final Offset initialOffset = _currentOffset;
  if (offset >= 0.0) {
    while (_currentOffset.dy < initialOffset.dy + offset) {
      if (!moveNext()) {
        break;
      }
    }
  } else {
    while (_currentOffset.dy > initialOffset.dy + offset) {
      if (!movePrevious()) {
        break;
      }
    }
  }
  return initialOffset != _currentOffset;
}