moveListRight method

void moveListRight()

Implementation

void moveListRight() {
  var list = widget.lists![draggedListIndex!];
  var listState = listStates[draggedListIndex!];
  widget.lists!.removeAt(draggedListIndex!);
  listStates.removeAt(draggedListIndex!);
  if(draggedListIndex != null){
    draggedListIndex = draggedListIndex! + 1;
  }
  widget.lists!.insert(draggedListIndex!, list);
  listStates.insert(draggedListIndex!, listState);
  canDrag = false;
  if (boardViewController != null && boardViewController.hasClients) {
    int? tempListIndex = draggedListIndex;
    boardViewController
        .animateTo(draggedListIndex! * widget.width, duration: new Duration(milliseconds: 400), curve: Curves.ease)
        .whenComplete(() {
      RenderBox object = listStates[tempListIndex!].context.findRenderObject() as RenderBox;
      Offset pos = object.localToGlobal(Offset.zero);
      leftListX = pos.dx;
      rightListX = pos.dx + object.size.width;
      Future.delayed(new Duration(milliseconds: widget.dragDelay), () {
        canDrag = true;
      });
    });
  }
  if(mounted){
    setState(() {});
  }
}