reorderCard method
void
reorderCard()
Implementation
void reorderCard() {
var boardProv = ref.read(ProviderList.boardProvider);
boardProv.board.lists[boardProv.board.dragItemOfListIndex!]
.items[boardProv.board.dragItemIndex!].child =
boardProv.board.lists[boardProv.board.dragItemOfListIndex!]
.items[boardProv.board.dragItemIndex!].prevChild;
// dev.log("MOVE=${prov.move}");
if (boardProv.move == 'LAST') {
// dev.log("LAST");
boardProv.board.lists[boardProv.board.dragItemOfListIndex!].items.add(
boardProv.board.lists[boardProv.draggedItemState!.listIndex!].items
.removeAt(boardProv.draggedItemState!.itemIndex!));
} else if (boardProv.move == "REPLACE") {
boardProv.board.lists[boardProv.board.dragItemOfListIndex!].items.clear();
boardProv.board.lists[boardProv.board.dragItemOfListIndex!].items.add(
boardProv.board.lists[boardProv.draggedItemState!.listIndex!].items
.removeAt(boardProv.draggedItemState!.itemIndex!));
} else {
//dev.log("LAST ELSE =${prov.board.lists[prov.board.dragItemOfListIndex!].items.length}");
// dev.log(
// "LENGTH= ${prov.board.lists[prov.board.dragItemOfListIndex!].items.length}");
// dev.log("DRAGGED INDEX =${prov.board.dragItemIndex!}");
// dev.log(
// "PLACING AT =${prov.move == "DOWN" ? prov.board.dragItemIndex! - 1 < 0 ? prov.board.dragItemIndex! : prov.board.dragItemIndex! - 1 : prov.board.dragItemIndex!}");
boardProv.board.lists[boardProv.board.dragItemOfListIndex!].items.insert(
boardProv.move == "DOWN"
? boardProv.board.dragItemIndex! - 1 < 0
? boardProv.board.dragItemIndex!
: boardProv.board.dragItemIndex! - 1
: boardProv.board.dragItemIndex!,
boardProv.board.lists[boardProv.draggedItemState!.listIndex!].items
.removeAt(boardProv.draggedItemState!.itemIndex!));
// dev.log(
// "LENGTH= ${prov.board.lists[prov.board.dragItemOfListIndex!].items.length}");
}
// prov.board.lists[prov.board.dragItemOfListIndex!].setState! ();
}