Interface

RulerScope

A scope used in MeasureScope.layout for the rulers parameter to allow a layout to define Ruler values for children.

RulerProducerUsage

@Sampled
@Composable
fun RulerProducerUsage(content: @Composable BoxScope.() -> Unit) {
    val safeInsets = WindowInsets.safeContent

    Box(
        Modifier.fillMaxSize().layout { measurable, constraints ->
            val placeable = measurable.measure(constraints)
            layout(
                width = placeable.width,
                height = placeable.height,
                rulers = {
                    val height = coordinates.size.height
                    SafeBottomRuler provides (height - safeInsets.getBottom(this)).toFloat()
                },
            ) {
                placeable.place(0, 0)
            }
        },
        content = content,
    )
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: