scrollByOffset method

Future<void> scrollByOffset(
  1. double offset, {
  2. Duration duration = const Duration(milliseconds: 300),
  3. Curve curve = Curves.easeInOut,
})

Scrolls the ScrollController by the given offset (smooth scroll).

offset is the value to add to the current scroll position (can be positive or negative). duration specifies the duration of the scroll animation. curve defines the curve for the animation (defaults to Curves.easeInOut).

Implementation

Future<void> scrollByOffset(
  double offset, {
  Duration duration = const Duration(milliseconds: 300),
  Curve curve = Curves.easeInOut,
}) {
  return animateTo(
    position.pixels + offset,
    duration: duration,
    curve: curve,
  );
}