OffsetModifier¶
data class OffsetModifier(val offset: IntCoordinates) : Modifier.Element<OffsetModifier> , LayoutChangingModifier
A Modifier.Element that shifts a composable's position by a fixed pixel offset after layout has been computed.
The offset is applied on top of any position assigned by the parent layout; it does not affect the parent's size calculation.
Only the last OffsetModifier in a chain takes effect.
Constructors¶
OffsetModifier¶
constructor(offset: IntCoordinates)
Properties¶
offset¶
val offset: IntCoordinates
Functions¶
all¶
open override fun all(predicate: (Modifier.Element<*>) -> Boolean): Boolean
Returns true if predicate returns true for all Elements in this Modifier or if this Modifier contains no Elements.
any¶
open override fun any(predicate: (Modifier.Element<*>) -> Boolean): Boolean
background¶
@Stable
fun Modifier.background(color: Int): Modifier
Fills the composable's background with a solid ARGB integer color.
@Stable
fun Modifier.background(color: KColor): Modifier
Fills the composable's background with a solid color.
@Stable
fun Modifier.background(startColor: Int, endColor: Int): Modifier
Fills the composable's background with a gradient between two ARGB integer colours.
@Stable
fun Modifier.background(startColor: KColor, endColor: KColor): Modifier
Fills the composable's background with a gradient from startColor to endColor going top-to-bottom.
@Stable
fun Modifier.background(
startColor: Int,
endColor: Int,
gradientDirection: GradientDirection = GradientDirection.TOP_TO_BOTTOM
): Modifier
Fills the composable's background with a directional gradient between two ARGB integer colours.
@Stable
fun Modifier.background(
startColor: KColor,
endColor: KColor,
gradientDirection: GradientDirection = GradientDirection.TOP_TO_BOTTOM
): Modifier
Fills the composable's background with a gradient from startColor to endColor in the given gradientDirection.
border¶
Adds a border using a raw ARGB integer color.
combinedClickable¶
@Stable
fun <T : AUINode> Modifier.combinedClickable(
onLongClick: (T, PointerEvent) -> Unit? = null,
onDoubleClick: (T, PointerEvent) -> Unit? = null,
onClick: (T, PointerEvent) -> Unit? = null
): Modifier
Adds multiple click-type handlers to a composable in a single modifier.
debug¶
Attaches one or more plain-text debug strings to the composable.
Attaches one or more formatted Component debug labels to the composable.
fillMaxHeight¶
@Stable
fun Modifier.fillMaxHeight(percent: Double = 1.0): Modifier
Forces the node to fill percent of the maximum available height.
fillMaxSize¶
@Stable
fun Modifier.fillMaxSize(percent: Double = 1.0): Modifier
Forces the node to fill percent of both the available width and height.
fillMaxWidth¶
@Stable
fun Modifier.fillMaxWidth(percent: Double = 1.0): Modifier
Forces the node to fill percent of the maximum available width.
foldIn¶
Accumulates a value starting with initial and applying operation to the current value and each element from outside in.
foldOut¶
Accumulates a value starting with initial and applying operation to the current value and each element from inside out.
getAll¶
Collects all Modifier.Element instances of type T from this modifier chain.
height¶
Sets an exact fixed height of height pixels (width unconstrained).
margin¶
Adds independent per-side margins around this composable.
Parameters
-
left: Left margin in pixels.
-
right: Right margin in pixels.
-
top: Top margin in pixels.
-
bottom: Bottom margin in pixels.
Adds symmetric horizontal and vertical margins.
Parameters
-
horizontal: Margin applied to both the left and right sides.
-
vertical: Margin applied to both the top and bottom sides.
Adds a uniform margin on all four sides.
Parameters
- all: The margin in pixels applied to every side.
mergeWith¶
open override fun mergeWith(other: OffsetModifier): OffsetModifier
modifyInnerConstraints¶
open fun modifyInnerConstraints(constraints: Constraints): Constraints
Adjusts the Constraints passed into this node for measuring its children.
modifyLayoutConstraints¶
open fun modifyLayoutConstraints(measuredSize: IntSize, constraints: Constraints): Constraints
Adjusts the Constraints as seen by the parent when it lays out this node.
modifyPosition¶
open override fun modifyPosition(offset: IntCoordinates): IntCoordinates
Shifts the node's placement by transforming the parent-supplied offset.
Return
The adjusted position for this node.
Parameters
- offset: The position computed by the parent layout.
offset¶
Shifts the composable by (x, y) pixels after layout.
The shift does not affect the space reserved for the composable in its parent layout.
Parameters
-
x: Horizontal pixel offset (positive moves right).
-
y: Vertical pixel offset (positive moves down).
onCharTyped¶
Registers a character-typed handler on this composable.
onDrag¶
Registers a drag event handler on this composable.
onGloballyPositioned¶
fun Modifier.onGloballyPositioned(onGloballyPositioned: (IntCoordinates) -> Unit): Modifier
onKeyEvent¶
Registers a key-press handler on this composable.
onPointerEvent¶
@Stable
fun <T : AUINode> Modifier.onPointerEvent(type: PointerEventType, onEvent: (T, PointerEvent) -> Unit): Modifier
Registers a handler for the given pointer type on this composable.
onScroll¶
Registers a scroll event handler on this composable.
onSizeChanged¶
fun Modifier.onSizeChanged(onSizeChanged: (Size) -> Unit): Modifier
Notifies callback of any size changes to element.
padding¶
Adds independent per-side padding inside this composable.
Parameters
-
left: Left padding in pixels.
-
right: Right padding in pixels.
-
top: Top padding in pixels.
-
bottom: Bottom padding in pixels.
Adds symmetric horizontal and vertical padding.
Parameters
-
horizontal: Padding applied to both the left and right sides.
-
vertical: Padding applied to both the top and bottom sides.
Adds uniform padding on all four sides.
Parameters
- all: The padding in pixels applied to every side.
size¶
sizeIn¶
Constrains the node's width and height to be within the given min/max bounds.
texture¶
Overrides the texture of theme-aware composables with the given ResourceLocation.
then¶
Concatenates this modifier with another.
toComponent¶
open fun toComponent(): Component
Converts this modifier element to a debug Component representation.
tooltip¶
Attaches one or more TooltipComponents to this composable.
unsafeMergeWith¶
open fun unsafeMergeWith(other: Modifier.Element<*>): OffsetModifier
width¶
Sets an exact fixed width of width pixels (height unconstrained).
zIndex¶
Sets the rendering depth of this composable relative to its siblings.
Higher values appear on top and receive input events before lower-valued siblings.
Parameters
- zIndex: The z-index to apply.