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

divkit.dsl.CircleShape.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

/**
 * Circle.
 * 
 * Can be created using the method [circleShape].
 * 
 * Required parameters: `type`.
 */
@Generated
class CircleShape internal constructor(
    @JsonIgnore
    val properties: Properties,
) : Shape {
    @JsonAnyGetter
    internal fun getJsonProperties(): Map = properties.mergeWith(
        mapOf("type" to "circle")
    )

    operator fun plus(additive: Properties): CircleShape = CircleShape(
        Properties(
            backgroundColor = additive.backgroundColor ?: properties.backgroundColor,
            radius = additive.radius ?: properties.radius,
            stroke = additive.stroke ?: properties.stroke,
        )
    )

    class Properties internal constructor(
        /**
         * Fill color.
         */
        val backgroundColor: Property?,
        /**
         * Radius.
         * Default value: `{"type":"fixed","value":10}`.
         */
        val radius: Property?,
        /**
         * Stroke style.
         */
        val stroke: Property?,
    ) {
        internal fun mergeWith(properties: Map): Map {
            val result = mutableMapOf()
            result.putAll(properties)
            result.tryPutProperty("background_color", backgroundColor)
            result.tryPutProperty("radius", radius)
            result.tryPutProperty("stroke", stroke)
            return result
        }
    }
}

/**
 * @param backgroundColor Fill color.
 * @param radius Radius.
 * @param stroke Stroke style.
 */
@Generated
fun DivScope.circleShape(
    `use named arguments`: Guard = Guard.instance,
    backgroundColor: Color? = null,
    radius: FixedSize? = null,
    stroke: Stroke? = null,
): CircleShape = CircleShape(
    CircleShape.Properties(
        backgroundColor = valueOrNull(backgroundColor),
        radius = valueOrNull(radius),
        stroke = valueOrNull(stroke),
    )
)

/**
 * @param backgroundColor Fill color.
 * @param radius Radius.
 * @param stroke Stroke style.
 */
@Generated
fun DivScope.circleShapeProps(
    `use named arguments`: Guard = Guard.instance,
    backgroundColor: Color? = null,
    radius: FixedSize? = null,
    stroke: Stroke? = null,
) = CircleShape.Properties(
    backgroundColor = valueOrNull(backgroundColor),
    radius = valueOrNull(radius),
    stroke = valueOrNull(stroke),
)

/**
 * @param backgroundColor Fill color.
 * @param radius Radius.
 * @param stroke Stroke style.
 */
@Generated
fun TemplateScope.circleShapeRefs(
    `use named arguments`: Guard = Guard.instance,
    backgroundColor: ReferenceProperty? = null,
    radius: ReferenceProperty? = null,
    stroke: ReferenceProperty? = null,
) = CircleShape.Properties(
    backgroundColor = backgroundColor,
    radius = radius,
    stroke = stroke,
)

/**
 * @param backgroundColor Fill color.
 * @param radius Radius.
 * @param stroke Stroke style.
 */
@Generated
fun CircleShape.override(
    `use named arguments`: Guard = Guard.instance,
    backgroundColor: Color? = null,
    radius: FixedSize? = null,
    stroke: Stroke? = null,
): CircleShape = CircleShape(
    CircleShape.Properties(
        backgroundColor = valueOrNull(backgroundColor) ?: properties.backgroundColor,
        radius = valueOrNull(radius) ?: properties.radius,
        stroke = valueOrNull(stroke) ?: properties.stroke,
    )
)

/**
 * @param backgroundColor Fill color.
 * @param radius Radius.
 * @param stroke Stroke style.
 */
@Generated
fun CircleShape.defer(
    `use named arguments`: Guard = Guard.instance,
    backgroundColor: ReferenceProperty? = null,
    radius: ReferenceProperty? = null,
    stroke: ReferenceProperty? = null,
): CircleShape = CircleShape(
    CircleShape.Properties(
        backgroundColor = backgroundColor ?: properties.backgroundColor,
        radius = radius ?: properties.radius,
        stroke = stroke ?: properties.stroke,
    )
)

/**
 * @param backgroundColor Fill color.
 */
@Generated
fun CircleShape.evaluate(
    `use named arguments`: Guard = Guard.instance,
    backgroundColor: ExpressionProperty? = null,
): CircleShape = CircleShape(
    CircleShape.Properties(
        backgroundColor = backgroundColor ?: properties.backgroundColor,
        radius = properties.radius,
        stroke = properties.stroke,
    )
)

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy