Hi, how can I actually convert a size in Dp to a s...
# compose
l
Hi, how can I actually convert a size in Dp to a size in Px in a composable ? I mean :
Copy code
@Composable
MyComposable(size: Dp) {
// how to get size in px ?
}
Because it seems that
withDensity
is not available in the newest API.
a
Copy code
@Composable
fun MyComposable(size: Dp) {
    with(DensityAmbient.current) {
        size.toPx()
    }
}
👍 1
l
Thank you very much 😃