rememberCollapsingToolbarScaffoldState changes when is not scrolled
Closed this issue · 1 comments
zenyagami commented
Added the option to remember the progress, sometimes scrolling the app stays in "moving state" recomposing the content
val state = rememberCollapsingToolbarScaffoldState()
val progress = state.toolbarState.progress
val topHeight = (54 * progress).dp
Timber.v("toolbar progress $progress topPadding:$topHeight ")
CollapsingToolbarScaffold(
toolbar = {
val defaultFontSize = 54
val smallFontSize = 20
val textSize =
(smallFontSize + (defaultFontSize - smallFontSize) * state.toolbarState.progress).sp
Box(
modifier = Modifier
.background(MaterialTheme.colorScheme.primary)
.fillMaxWidth()
.height(80.dp)
.pin()
)
TransactionHeader(balance = "325,57 €", {}, {}, {}, {},
balanceTextSize = textSize,
topBarAlpha = progress,
topHeight = topHeight
)
},
modifier = Modifier.fillMaxWidth(),
scrollStrategy = ScrollStrategy.ExitUntilCollapsed,
state = state
) {
LazyListWithItems()
}
}
the progress
keep updating even when the screen is not touched.
sometimes happens after doing overscroll or just playing around, and this issue happens, any suggestions? Thanks
onebone commented
Try placing fake composable to fix the maximum height of the toolbar. The cause is that the height of the maximum height is changing, thus progress which is derived from the value changes inconsistently.