changeItemPosition static method
void
changeItemPosition(
)
Implementation
static void changeItemPosition(
List<DraggableAnimationItem> menuList,
DraggableAnimationItem fromMenu,
DraggableAnimationItem toMenu
){
int fromIndex = menuList.indexWhere((e) => e.id == fromMenu.id);
int toIndex = menuList.indexWhere((e) => e.id == toMenu.id);
if (fromIndex == -1 || toIndex == -1) {
print('One or both items not found in the list.');
return;
}
var removedItem = menuList.removeAt(fromIndex);
menuList.insert(toIndex, removedItem);
}