lesincs
10/18/2024, 10:56 PMDropDownMenu
ignores Density
provided from upper tree. It seems the density has been re-provided at some point inside DropDownMenu
. Is this a compose bug or it's intended? I saw a similar discuss two years ago: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1659191411566189
Following code demonstrates it:
CompositionLocalProvider(
LocalDensity provides customizedDensity
) {
DropdownMenu(
...
) {
val density = LocalDensity.current
assertTrue(customizedDensity != density)
}
}
Stylianos Gakis
10/18/2024, 11:01 PMlesincs
10/18/2024, 11:23 PMStylianos Gakis
10/18/2024, 11:40 PMAlex Vanyo
10/18/2024, 11:48 PMDensity
, is this for testing, a font scale feature, or a different reason?lesincs
10/19/2024, 12:11 AMryan.fonzi
10/19/2024, 6:38 AMLocalDensity
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 LocalDensity
to the window's content.