Skip to main content

local_density

Function local_density 

Source
pub fn local_density() -> StaticCompositionLocal<Density>
Expand description

The StaticCompositionLocal carrying the device pixel grid.

Compose’s LocalDensity, static as Compose’s is: a read subscribes nothing, and a provider given a different grid recomposes everything under it. Its default is whatever grid the host installed on this shell, so an application that never provides one still measures against the real screen; providing one scopes a different grid to a subtree, which is what a preview, a scaled container or a density-specific golden needs.