scrollToPositionIfNotAtBottom method

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

Scrolls to the given position only if the position is not at the bottom already.

Implementation

Future<void> scrollToPositionIfNotAtBottom(
  double offset, {
  Duration duration = const Duration(milliseconds: 300),
  Curve curve = Curves.easeInOut,
}) {
  if (!isAtBottom) {
    return animateToPosition(offset, duration: duration, curve: curve);
  }
  return Future.value();
}