NTP-30527 | Divider Property Int to Float (#675)

This commit is contained in:
Soumya Ranjan Patra
2025-01-21 19:34:34 +05:30
committed by GitHub
parent 18cfde0284
commit d53fa6fbe8
3 changed files with 8 additions and 9 deletions

View File

@@ -9,9 +9,9 @@ package com.navi.uitron.model.ui
data class DividerProperty(
var color: String? = null,
var thickness: Int? = null,
var separation: Int? = null,
var dashedAtomicWidth: Int? = null,
var thickness: Float? = null,
var separation: Float? = null,
var dashedAtomicWidth: Float? = null,
) : BaseProperty() {
override fun copyNonNullFrom(property: BaseProperty?) {
super.copyNonNullFrom(property)

View File

@@ -56,7 +56,7 @@ class DividerRenderer : Renderer<DividerProperty> {
}
if (property.visible.orTrue()) {
val rootView = LocalView.current.rootView
if (property.separation == null || property.separation == 0) {
if (property.separation == null || property.separation == 0f) {
Divider(
modifier =
if (UiTronSdkManager.isModifierBuilderEnabled()) {
@@ -102,10 +102,8 @@ class DividerRenderer : Renderer<DividerProperty> {
val pathEffect =
PathEffect.dashPathEffect(
floatArrayOf(
property.dashedAtomicWidth?.toFloat()
?: property.separation?.times(2f)
?: 0f,
property.separation?.toFloat() ?: 0f,
property.dashedAtomicWidth ?: property.separation?.times(2f) ?: 0f,
property.separation ?: 0f,
),
0f,
)

View File

@@ -203,8 +203,9 @@ class UiTronBrush(
}
}
private val colorData: Array<Pair<Float, Color>>? =
private val colorData: Array<Pair<Float, Color>> =
brushData?.colorStops?.map { Pair(it.first, it.second.hexToComposeColor) }?.toTypedArray()
?: arrayOf(Pair(0f, Color.Transparent), Pair(1f, Color.Transparent))
private val processedColorStops = colorData as Array<out Pair<Float, Color>>
private val tileMode = getTileMode(brushData?.tileMode)
private val gradientColors = processedColorStops.map { it.second }