All Downloads are FREE. Search and download functionalities are using the official Maven repository.

divkit.dsl.SolidBackground.kt Maven / Gradle / Ivy

Go to download

DivKit is an open source Server-Driven UI (SDUI) framework. SDUI is a an emerging technique that leverage the server to build the user interfaces of their mobile app.

There is a newer version: 30.19.0
Show newest version
@file:Suppress(
    "unused",
    "UNUSED_PARAMETER",
)

package divkit.dsl

import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonValue
import divkit.dsl.annotation.*
import divkit.dsl.core.*
import divkit.dsl.scope.*
import kotlin.Any
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.collections.Map

/**
 * Solid background color.
 * 
 * Can be created using the method [solidBackground].
 * 
 * Required parameters: `type, color`.
 */
@Generated
class SolidBackground internal constructor(
    @JsonIgnore
    val properties: Properties,
) : Background, TextRangeBackground {
    @JsonAnyGetter
    internal fun getJsonProperties(): Map = properties.mergeWith(
        mapOf("type" to "solid")
    )

    operator fun plus(additive: Properties): SolidBackground = SolidBackground(
        Properties(
            color = additive.color ?: properties.color,
        )
    )

    class Properties internal constructor(
        /**
         * Color.
         */
        val color: Property?,
    ) {
        internal fun mergeWith(properties: Map): Map {
            val result = mutableMapOf()
            result.putAll(properties)
            result.tryPutProperty("color", color)
            return result
        }
    }
}

/**
 * @param color Color.
 */
@Generated
fun DivScope.solidBackground(
    color: Color? = null,
): SolidBackground = SolidBackground(
    SolidBackground.Properties(
        color = valueOrNull(color),
    )
)

/**
 * @param color Color.
 */
@Generated
fun DivScope.solidBackgroundProps(
    `use named arguments`: Guard = Guard.instance,
    color: Color? = null,
) = SolidBackground.Properties(
    color = valueOrNull(color),
)

/**
 * @param color Color.
 */
@Generated
fun TemplateScope.solidBackgroundRefs(
    `use named arguments`: Guard = Guard.instance,
    color: ReferenceProperty? = null,
) = SolidBackground.Properties(
    color = color,
)

/**
 * @param color Color.
 */
@Generated
fun SolidBackground.override(
    `use named arguments`: Guard = Guard.instance,
    color: Color? = null,
): SolidBackground = SolidBackground(
    SolidBackground.Properties(
        color = valueOrNull(color) ?: properties.color,
    )
)

/**
 * @param color Color.
 */
@Generated
fun SolidBackground.defer(
    `use named arguments`: Guard = Guard.instance,
    color: ReferenceProperty? = null,
): SolidBackground = SolidBackground(
    SolidBackground.Properties(
        color = color ?: properties.color,
    )
)

/**
 * @param color Color.
 */
@Generated
fun SolidBackground.evaluate(
    `use named arguments`: Guard = Guard.instance,
    color: ExpressionProperty? = null,
): SolidBackground = SolidBackground(
    SolidBackground.Properties(
        color = color ?: properties.color,
    )
)

@Generated
fun SolidBackground.asList() = listOf(this)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy