boardScroll method

void boardScroll()

Implementation

void boardScroll() async {
  if ((board.isElementDragged == false && board.isListDragged == false) ||
      scrolling) {
    return;
  }
  if (board.controller.offset < board.controller.position.maxScrollExtent &&
      valueNotifier.value.dx + (draggedItemState!.width / 2) >
          board.controller.position.viewportDimension - 100) {
    scrolling = true;
    scrollingRight = true;
    if (board.boardScrollConfig == null) {
      log("HEREEEE");
      await board.controller.animateTo(board.controller.offset + 100,
          duration: const Duration(milliseconds: 100), curve: Curves.linear);
    } else {
      await board.controller.animateTo(
          board.boardScrollConfig!.offset + board.controller.offset,
          duration: board.boardScrollConfig!.duration,
          curve: board.boardScrollConfig!.curve);
    }
    scrolling = false;
    scrollingRight = false;
    boardScroll();
  } else if (board.controller.offset > 0 && valueNotifier.value.dx <= 0) {
    scrolling = true;
    scrollingLeft = true;

    if (board.boardScrollConfig == null) {
      await board.controller.animateTo(board.controller.offset - 100,
          duration:
              Duration(milliseconds: valueNotifier.value.dx < 20 ? 50 : 100),
          curve: Curves.linear);
    } else {
      await board.controller.animateTo(
          board.controller.offset - board.boardScrollConfig!.offset,
          duration: board.boardScrollConfig!.duration,
          curve: board.boardScrollConfig!.curve);
    }

    scrolling = false;
    scrollingLeft = false;
    boardScroll();
  } else {
    return;
  }
}