RulerScope


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

import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.safeContent import androidx.compose.ui.Modifier import androidx.compose.ui.layout.layout 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, )

Summary

Public functions

infix Unit

Provides a constant value for a Ruler.

Cmn
infix Unit

Provides a VerticalRuler value that is relative to the left side in an LTR layout or right side on an RTL layout.

Cmn

Public properties

LayoutCoordinates

LayoutCoordinates of the position in the hierarchy that the Ruler will be provided.

Cmn

Inherited functions

From androidx.compose.ui.unit.Density
open Int

Convert Dp to Int by rounding

Cmn
open Int

Convert Sp to Int by rounding

Cmn
open Dp

Convert an Int pixel value to Dp.

Cmn
open Dp

Convert a Float pixel value to a Dp

Cmn
open DpSize

Convert a Size to a DpSize.

Cmn
open Float

Convert Dp to pixels.

Cmn
open Float

Convert Sp to pixels.

Cmn
open Rect

Convert a DpRect to a Rect.

Cmn
open Size

Convert a DpSize to a Size.

Cmn
open TextUnit

Convert an Int pixel value to Sp.

Cmn
open TextUnit

Convert a Float pixel value to a Sp

Cmn
From androidx.compose.ui.unit.FontScaling
open Dp

Convert Sp to Dp.

Cmn
open TextUnit

Convert Dp to Sp.

Cmn

Inherited properties

From androidx.compose.ui.unit.Density
Float

The logical density of the display.

Cmn
From androidx.compose.ui.unit.FontScaling
Float

Current user preference for the scaling factor for fonts.

Cmn

Public functions

provides

infix fun Ruler.provides(value: Float): Unit

Provides a constant value for a Ruler.

providesRelative

infix fun VerticalRuler.providesRelative(value: Float): Unit

Provides a VerticalRuler value that is relative to the left side in an LTR layout or right side on an RTL layout.

Public properties

coordinates

val coordinatesLayoutCoordinates

LayoutCoordinates of the position in the hierarchy that the Ruler will be provided.