Spacing

class Spacing(defaultValue: Float, spacing: FloatArray)

Class representing CSS spacing (padding, margin, and borders). This is mostly necessary to properly implement interactions and updates for properties like margin, marginLeft, and marginHorizontal.

Constructors

Link copied to clipboard
constructor()
constructor(defaultValue: Float)
constructor(original: Spacing)

Copy constructor.

constructor(defaultValue: Float, spacing: FloatArray)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
operator fun get(spacingType: Int): Float

Get the spacing for a direction. This takes into account any default values that have been set.

Link copied to clipboard
fun getRaw(spacingType: Int): Float

Get the raw value (that was set using .set), without taking into account any default values.

Link copied to clipboard
fun getWithFallback(spacingType: Int, fallbackType: Int): Float

Try to get start value and fallback to given type if not defined. This is used privately by the layout engine as a more efficient way to fetch direction-aware values by avoid extra method invocations.

Link copied to clipboard
fun reset()

Resets the spacing instance to its default state. This method is meant to be used when recycling Spacing instances.

Link copied to clipboard
operator fun set(spacingType: Int, value: Float): Boolean

Set a spacing value.