CompositionLocalProvider(
LocalDensity provides customizedDensity
) {
DropdownMenu(
...
) {
val density = LocalDensity.current
assertTrue(customizedDensity != density)
}
}
s
Stylianos Gakis
10/18/2024, 11:01 PM
Does it work if you re-provide it inside the content lambda?
l
lesincs
10/18/2024, 11:23 PM
It works - that’s actually my current workaround. But it’s not a for good solution as every time if I have sth which renders on a separate window (Popup, Dialog) I have to do it again.
s
Stylianos Gakis
10/18/2024, 11:40 PM
Just wanted to check. I'd file a report anyway then
👍 1
a
Alex Vanyo
10/18/2024, 11:48 PM
I’m curious what your use case is for customizing the
Density
, is this for testing, a font scale feature, or a different reason?
2 year old thread jumpscare 😂
My use case was fixing incorrect display metrics on a custom device we're developing for. It's for a kiosk-like app, so we override
LocalDensity
at the very top of the compose tree and that handles everything we care about.
We ended up making a wrapper for every window-creating composable that just re-provides