https://kotlinlang.org logo
Title
r

ryan.fonzi

07/30/2022, 2:30 PM
Dialog
seems to ignore the density values in
LocalDensity
for its content. 🧵
i.e. Something like
CompositionLocalProvider(LocalDensity provides Density(1.5f, 1.5f)) {
    // other content

    Dialog(..) {
        // dialog content
    }
}
..will scale whatever's in "other content", but "dialog content" remains unscaled. But if you re-wrap the dialog content it works on both:
CompositionLocalProvider(LocalDensity provides Density(1.5f, 1.5f)) {
    // other content

    
    Dialog(..) {
        CompositionLocalProvider(LocalDensity provides Density(1.5f, 1.5f)) {
            // dialog content
        }
    }
}
Is this a bug or intentional?
This is with compose ui 1.2.0-beta03
d

Dominaezzz

07/30/2022, 3:27 PM
It's possible that composition locals aren't being passed through.
r

ryan.fonzi

07/30/2022, 4:09 PM
Some are. Theming doesn't look like it's broken.
d

Dominaezzz

07/30/2022, 4:10 PM
Ah I see.
r

ryan.fonzi

07/30/2022, 4:11 PM
I wonder if it's because of a weird interaction with the dialog window. The device configuration hasn't changed, just the
LocalDensity
.
d

Dominaezzz

07/30/2022, 4:12 PM
Is
Popup
available on Android?
r

ryan.fonzi

07/30/2022, 4:14 PM
Pretty sure that's how
DropdownMenu
works. Lemme try that.
The popup isn't affected by
LocalDensity
either
so it is a window thing
d

Dominaezzz

07/30/2022, 4:18 PM
Yeah that's interesting.
r

ryan.fonzi

07/30/2022, 4:18 PM
I don't even know if this is incorrect behavior. The system's own density is consistent with these windows. I'm just overriding it within the context of my own app.
i guess you could say i'm providing the content, so the dialog's behavior is incorrect if i expect that content to be scaled consistently with the rest of my app