Erik
hfhbd
var newItem: Question? by remember { mutableStateOf(null) } var questions by remember { mutableListOf() } for (question in questions) { Div(attrs = { draggable(Draggable.True) onDragStart { newItem = question } onDragOver { event -> event.nativeEvent.preventDefault() } onDrop { event -> event.nativeEvent.preventDefault() val item = requireNotNull(newItem) { "onDrop in question list $title" } val changed = questions.toMutableList().apply { remove(item) add(index, item) } newItem = null } }) { Text(question.title) } }
Oleksandr Karpovich [JB]
A modern programming language that makes developers happier.