compose-collapsing-toolbar icon indicating copy to clipboard operation
compose-collapsing-toolbar copied to clipboard

fix height issue when maxHeight changes while expanded

Open phcannesson opened this issue 1 year ago • 3 comments

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.

phcannesson avatar Nov 08 '23 10:11 phcannesson

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

Veeksi avatar Mar 01 '24 11:03 Veeksi

@onebone any news to accept this change?

johan-padilla avatar Apr 05 '24 21:04 johan-padilla

    @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

masterdev01 avatar Jun 03 '24 09:06 masterdev01