compose-collapsing-toolbar
compose-collapsing-toolbar copied to clipboard
fix height issue when maxHeight changes while expanded
This PR aims to fix the issue mentioned in issue #100, which I'm also facing in my app.
The logic is to update height
when maxHeight
changes while the toolbar is fully expanded.
Looks like this PR fixes my issue as well because my toolbar uses dynamic height when calculating statusBarHeight. I hope this gets merged asap!
https://github.com/onebone/compose-collapsing-toolbar/issues/103
@onebone any news to accept this change?
@Composable
fun rememberStatusBarHeightDp(): Dp {
val view = LocalView.current
val density = LocalDensity.current
val statusBarHeightPx = remember {
ViewCompat.getRootWindowInsets(view)
?.getInsets(WindowInsetsCompat.Type.statusBars())
?.top ?: 0
}
return with(density) { statusBarHeightPx.toDp() }
}
Use this code for top padding