scrollLevelDown method

void scrollLevelDown()

Implementation

void scrollLevelDown() {
  if (_scrollController == null) return;

  double itemHeight = widget.itemHeight;
  double nextPosition = _scrollController!.offset + itemHeight;
  double roundToNextItemPosition =
      (nextPosition / itemHeight).round() * itemHeight;
  _scrollController!.animateTo(
    roundToNextItemPosition,
    duration: const Duration(milliseconds: 200),
    curve: Curves.fastOutSlowIn,
  );
}