commonMain.app.cash.redwood.layout.testing.MutableBox.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of redwood-layout-testing Show documentation
Show all versions of redwood-layout-testing Show documentation
Multiplatform reactive UI using Kotlin and Jetpack Compose
@file:Suppress("DEPRECATION", "OVERRIDE_DEPRECATION")
package app.cash.redwood.layout.testing
import app.cash.redwood.Modifier
import app.cash.redwood.layout.api.Constraint
import app.cash.redwood.layout.api.CrossAxisAlignment
import app.cash.redwood.layout.widget.Box
import app.cash.redwood.testing.WidgetValue
import app.cash.redwood.ui.Margin
import app.cash.redwood.widget.MutableListChildren
import kotlin.Suppress
internal class MutableBox : Box {
override val `value`: WidgetValue
get() = BoxValue(
modifier = modifier,
width = width!!,
height = height!!,
margin = margin!!,
horizontalAlignment = horizontalAlignment!!,
verticalAlignment = verticalAlignment!!,
children = children.map { it.`value` },
)
override var modifier: Modifier = Modifier
private var width: Constraint? = null
private var height: Constraint? = null
private var margin: Margin? = null
private var horizontalAlignment: CrossAxisAlignment? = null
private var verticalAlignment: CrossAxisAlignment? = null
override val children: MutableListChildren = MutableListChildren()
override fun width(width: Constraint) {
this.width = width
}
override fun height(height: Constraint) {
this.height = height
}
override fun margin(margin: Margin) {
this.margin = margin
}
override fun horizontalAlignment(horizontalAlignment: CrossAxisAlignment) {
this.horizontalAlignment = horizontalAlignment
}
override fun verticalAlignment(verticalAlignment: CrossAxisAlignment) {
this.verticalAlignment = verticalAlignment
}
}