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

Dazai

05/09/2022, 3:14 AM
is there a clean way to do this?
l

lilypuchi

05/09/2022, 3:27 AM
You must be getting the error for
LocalDensity.current
right? You can declare it outside (in the
@Composable
context) and use it from there on. Something like,
Copy code
@Composable
fun Screen(
    modifier: Modifier = Modifier,
    navigateBack: () -> Unit,
) {
    val density = LocalDensity.current

    Column(
        modifier = modifier
            .clickable {
                with(density) {
    
                }
            }
    ) {}
}
d

Dazai

05/09/2022, 3:41 AM
this worked, thanks!
🙌 1