Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rememberCollapsingToolbarScaffoldState changes when is not scrolled #46

Closed
zenyagami opened this issue Apr 19, 2022 · 1 comment
Closed
Labels
support Asking for help regarding to the usage of library

Comments

@zenyagami
Copy link

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
Copy link
Owner

onebone commented Apr 21, 2022

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.

@onebone onebone added the support Asking for help regarding to the usage of library label Apr 24, 2022
@onebone onebone closed this as completed Apr 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Asking for help regarding to the usage of library
Projects
None yet
Development

No branches or pull requests

2 participants