From 45fc37e223b2b0bec97d44a8e18250a76a3602bc Mon Sep 17 00:00:00 2001 From: AllenTom Date: Tue, 17 Sep 2024 16:35:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=20key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/aiosman/riderpro/ui/composables/DragAndDrop.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/aiosman/riderpro/ui/composables/DragAndDrop.kt b/app/src/main/java/com/aiosman/riderpro/ui/composables/DragAndDrop.kt index 9551ccf..aa41065 100644 --- a/app/src/main/java/com/aiosman/riderpro/ui/composables/DragAndDrop.kt +++ b/app/src/main/java/com/aiosman/riderpro/ui/composables/DragAndDrop.kt @@ -39,6 +39,7 @@ import androidx.compose.ui.zIndex import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.launch +import java.util.UUID @OptIn(ExperimentalFoundationApi::class) @@ -65,7 +66,7 @@ fun DraggableGrid( horizontalArrangement = Arrangement.spacedBy(16.dp), ) { - itemsIndexed(items, key = { _, item -> item }) { index, item -> + itemsIndexed(items, key = { _, item -> "${item}-${UUID.randomUUID()}" }) { index, item -> DraggableItem(dragDropState, index) { isDragging -> content(item, isDragging) }