APP-1438 | Fixed Card Shadow Issues (#33)
This commit is contained in:
committed by
GitHub Enterprise
parent
4fae654dc2
commit
798bebd21e
@@ -13,7 +13,6 @@ import com.navi.uitron.model.UiTronResponse
|
||||
import com.navi.uitron.render.UiTronRenderer
|
||||
import com.navi.uitron.viewmodel.UiTronViewModel
|
||||
import com.uitron.demo.mockApiResponse
|
||||
import java.lang.Exception
|
||||
|
||||
/**
|
||||
* Copyright © 2023 by Navi Technologies Private Limited
|
||||
@@ -48,17 +47,19 @@ fun MockScreen() {
|
||||
) {
|
||||
if (mockValue.value.isEmpty().not()) {
|
||||
val context = LocalContext.current
|
||||
var errorMessage: String? = null
|
||||
val uiTronResponse: UiTronResponse? = try {
|
||||
val type = object : TypeToken<UiTronResponse>() {}.type
|
||||
mockApiResponse<UiTronResponse>(context, type, mockValue.value)
|
||||
} catch (e: Exception) {
|
||||
errorMessage = e.message
|
||||
null
|
||||
}
|
||||
uiTronResponse?.let {
|
||||
UiTronRenderer(uiTronResponse.data, uiTronViewModel = UiTronViewModel())
|
||||
.Render(composeViews = uiTronResponse.parentComposeView.orEmpty())
|
||||
} ?: kotlin.run {
|
||||
Text(text = "Error In Mock Config", color = Color.Red)
|
||||
Text(text = "Error In Mock Config \n $errorMessage", color = Color.Red)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1459,5 +1459,30 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"cardShadowTemplate": {
|
||||
"parentComposeView": [
|
||||
{
|
||||
"property": {
|
||||
"viewType": "Card",
|
||||
"layoutId": "card_1",
|
||||
"height": "100",
|
||||
"width": "MATCH_PARENT",
|
||||
"backgroundColor": "#FFE388",
|
||||
"shape": {
|
||||
"shapeType": "RoundedCornerShape",
|
||||
"size": 16
|
||||
},
|
||||
"elevation": 8,
|
||||
"padding": {
|
||||
"start": 20,
|
||||
"top": 20,
|
||||
"end": 20,
|
||||
"bottom": 20
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"data": {}
|
||||
}
|
||||
}
|
||||
@@ -62,10 +62,11 @@ class CardRenderer(
|
||||
bottom = property.padding?.bottom?.dp ?: 0.dp
|
||||
)
|
||||
.shadow(
|
||||
elevation = property.elevation?.dp ?: 8.dp,
|
||||
elevation = property.elevation?.dp ?: 0.dp,
|
||||
ambientColor = property.ambientColor?.hexToComposeColor
|
||||
?: DefaultShadowColor,
|
||||
spotColor = property.spotColor?.hexToComposeColor ?: DefaultShadowColor
|
||||
spotColor = property.spotColor?.hexToComposeColor ?: DefaultShadowColor,
|
||||
shape = ShapeUtil.getShape(shape = property.shape),
|
||||
)
|
||||
.customClickable(
|
||||
{
|
||||
@@ -73,7 +74,7 @@ class CardRenderer(
|
||||
}, interaction = property.interaction,
|
||||
actions = uiTronData?.onClick?.actions
|
||||
),
|
||||
shape = ShapeUtil.getShape(shape = property.shape),
|
||||
elevation = 0.dp,
|
||||
backgroundColor = property.backgroundColor?.hexToComposeColor ?: Color.White,
|
||||
border = BorderStroke(
|
||||
property.borderStrokeData?.width?.dp ?: 0.dp,
|
||||
|
||||
Reference in New Issue
Block a user