-
Notifications
You must be signed in to change notification settings - Fork 113
Open
Description
description: dragging item is not showing. I tried to change item color but not showing when item is dragging.
I think it worked until before I changed my compose version.
reorderable version :0.9.6
related version:
composeOptions {
kotlinCompilerExtensionVersion '1.5.10'
kotlinCompilerVersion '1.9.22'
}
implementation platform('androidx.compose:compose-bom:2023.03.00')
implementation 'androidx.compose.ui:ui-tooling:1.5.0'
code:
val reorderState = rememberReorderableLazyListState(onMove = { from, to ->
viewModel.onChangeSortProduct(from.index, to.index)
}, canDragOver = { from, to -> from.index > 0 && to.index > 0 })
LazyColumn(
state = reorderState.listState,
modifier = Modifier
.reorderable(reorderState)
.detectReorderAfterLongPress(reorderState)
) {
items(
viewModel.productList,
key = { item -> item.productUiModel?.id ?: -1 }) { item ->
ReorderableItem(
reorderState,
key = item.productUiModel?.id ?: -1
) { isDragging ->
val elevation by animateDpAsState(
if (isDragging) 16.dp else 0.dp,
label = ""
)
if (item.isHeader) {
ProductSettingsSection(
title = stringResource(id = R.string.kcatalog_title),
initialTitleKeyword = state.title,
onTitleKeywordChange = {
viewModel.onTitleChanged(it)
},
priceShowList = priceShowList,
initialPriceShowItem = priceShowList.find { it.id == state.isPriceShow }
?: priceShowList.get(0),
onPriceShowSelected = {
viewModel.onPriceShowSelected(it.id)
},
expireDateList = expireDateList,
initialExpireDateItem = expireDateList.find { it.id == state.selectedExpireDate }
?: expireDateList.get(0),
onExpireDateSelected = {
viewModel.onExpireDateSelected(it.id)
}
)
} else {
OneRowProductItem(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 10.dp)
.shadow(elevation)
.background(MaterialTheme.colorScheme.surface),
image = item.productUiModel?.imageUrl ?: "",
title = item.productUiModel?.name ?: "",
price = item.productUiModel?._price ?: 0,
onMoreClick = {
item.productUiModel?.id?.let {
showBottomSheet(it)
}
},
)
}
}
}
}
Screen_recording_20241023_165635.webm
Metadata
Metadata
Assignees
Labels
No labels