https://kotlinlang.org logo
#compose
Title
# compose
d

Devesh Sanghvi

07/31/2020, 12:30 AM
Can I get the height of a child composable function if I pass it as a parameter? example:
Copy code
fun CustomBottomDrawerLayout(
        drawerState: DrawerState,
        onStateChange: (DrawerState) -> Unit,
        gesturesEnabled: Boolean = true,
        drawerShape: Shape = MaterialTheme.shapes.large,
        drawerElevation: Dp = DrawerConstants.DefaultElevation,
        drawerContent: @Composable() () -> Unit,
        bodyContent: @Composable() () -> Unit
) {
Can I calculate the height of the drawerContent?
t

Timo Drick

08/01/2020, 12:51 PM
You could also wrap the child by a box and add a .OnPositioned modifier. But in my tests this not works well for animations because the position reading is one frame behind
2 Views