offset

@Stable
fun Modifier.offset(x: Int = 0, y: Int = 0): Modifier

Offset the content by (x, y). The offsets can be positive as well as non-positive. Applying an offset only changes the position of the content, without interfering with its size measurement.

A positive x offset will always move the content to the right.


fun Modifier.offset(offset: () -> IntOffset): Modifier

Offset the content by offset. The offsets can be positive as well as non-positive. Applying an offset only changes the position of the content, without interfering with its size measurement.

This modifier is designed to be used for offsets that change, possibly due to user interactions. It avoids recomposition when the offset is changing, and also adds a graphics layer that prevents unnecessary redrawing of the context when the offset is changing.

A positive horizontal offset will always move the content to the right.