Tolriq
10/31/2024, 9:19 AManimatePlaceholder
then there's no recomposition on isContent ready change. (Also if you remove the placeholderShimmer
so not tied to shimmer.stevebower
11/01/2024, 9:30 AMstevebower
11/01/2024, 2:11 PMTolriq
11/01/2024, 2:34 PMScreenScaffold(scrollState = scalingLazyColumnState) {
ScalingLazyColumn2(scalingLazyColumnState) {
item {
val placeholderState = rememberPlaceholderState {
viewModel.items != null
}
ResponsiveListHeader(contentPadding = firstItemPadding()) {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Text(
viewModel.wearMediaCollection.title,
color = MaterialTheme.colorScheme.onSurface,
fontWeight = FontWeight.Bold,
style = MaterialTheme.typography.titleMedium,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
textAlign = TextAlign.Center,
modifier = Modifier.fillParentMaxWidth(),
)
if (viewModel.items == null || viewModel.description.isNotEmpty()) {
Text(
viewModel.description,
style = MaterialTheme.typography.labelSmall,
textAlign = TextAlign.Center,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier
.fillMaxWidth()
.padding(top = 8.dp)
//.placeholderShimmer(placeholderState)
.placeholder(placeholderState),
)
}
}
if (!placeholderState.isHidden) {
//LaunchedEffect(placeholderState) { placeholderState.animatePlaceholder() }
}
}
}
Notice the removal of the animatePlaceholder
in that case the placeholder does not update when the viewModel.item is no more null.Tolriq
11/01/2024, 2:36 PMLaunchedEffect(placeholderState) { placeholderState.animatePlaceholder() }
does work. I did not have that call in some screen as no shimmer and it worked before.stevebower
11/01/2024, 3:16 PMif (!placeholderState.isHidden) {
LaunchedEffect(placeholderState) { placeholderState.animatePlaceholder() }
}
Tolriq
11/01/2024, 3:18 PM