# RectRulers

Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/layout/RectRulers.kt+class:androidx.compose.ui.layout.RectRulers) Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.9.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface RectRulers
  ```

*** ** * ** ***

A collection of `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Ruler`s used to define a Rectangle.

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.layout.WindowInsetsRulers
import androidx.compose.ui.layout.layout
import androidx.compose.ui.unit.Constraints

Layout(
    modifier = Modifier.fillMaxSize(),
    content = {
        Box(Modifier.background(Color.Blue)) // top area (e.g. status bar)
        Box(Modifier.background(Color.Yellow)) // bottom area (e.g. navigation bar)
        Box(Modifier.background(Color.White)) // content between top and bottom
    },
    measurePolicy = { measurables, constraints ->
        if (constraints.hasBoundedWidth && constraints.hasBoundedHeight) {
            val width = constraints.maxWidth
            val height = constraints.maxHeight
            layout(width, height) {
                val top =
                    maxOf(0, WindowInsetsRulers.SystemBars.current.top.current(0f).roundToInt())
                val topArea = measurables[0].measure(Constraints.fixed(width, top))
                topArea.place(0, 0)

                val bottom =
                    minOf(
                        height,
                        WindowInsetsRulers.SystemBars.current.bottom.current(0f).roundToInt(),
                    )
                val bottomArea =
                    measurables[1].measure(Constraints.fixed(width, height - bottom))
                bottomArea.place(0, bottom)

                val contentArea = measurables[2].measure(Constraints.fixed(width, bottom - top))
                contentArea.place(0, top)
            }
        } else {
            // It should only get here if inside scrollable content or trying to align
            // to an alignment line. Only place the content.
            val placeable = measurables[2].measure(constraints) // content
            layout(placeable.width, placeable.height) { placeable.place(0, 0) }
        }
    },
)
```

## Summary

| ### Nested types |
|---|
| `object https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/RectRulers.Companion` |

| ### Public properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/HorizontalRuler` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/RectRulers#bottom()` The bottom position of the rectangle | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/VerticalRuler` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/RectRulers#left()` The left position of the rectangle. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/VerticalRuler` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/RectRulers#right()` The right position of the rectangle | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/HorizontalRuler` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/RectRulers#top()` The top position of the rectangle. | Cmn |

## Public properties

### bottom

Cmn Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.9.0)

```
val bottom: HorizontalRuler
```

The bottom position of the rectangle

### left

Cmn Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.9.0)

```
val left: VerticalRuler
```

The left position of the rectangle.

### right

Cmn Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.9.0)

```
val right: VerticalRuler
```

The right position of the rectangle

### top

Cmn Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.9.0)

```
val top: HorizontalRuler
```

The top position of the rectangle.