MeasureComposableWidth

fun MeasureComposableWidth(composable: @Composable () -> Unit, content: @Composable (width: Dp) -> Unit)

This method calculates the width of the composable. It can be used such that the parent view wrapping the composable can adjust its width.

Adapted from: https://stackoverflow.com/a/70508246

Parameters

composable

the composable that will be measured

content

the content to render, calls back with the calculated width of the composable