Descript
I want to draw a line at the compose with the compose canvas inside a compose widget,but it's just show at the preview! If just copy the canvas part code,it can Correct display!
The compose code
Card(
elevation = 6.dp,
shape = RoundedCornerShape(15.dp),
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 12.dp, vertical = 8.dp)
) {
Row(
modifier = Modifier
.fillMaxWidth()
.background(color = backgroundColor),
) {
AsyncImage(modifier = Modifier
.height(180.dp)
.width(120.dp)
.padding(12.dp)
... )
Row(
modifier = Modifier.fillMaxSize()
) {
Column(
modifier = Modifier
.fillMaxHeight()
.weight(0.7f)
) {
...
}
Canvas(
modifier = Modifier
.weight(0.3f)
.fillMaxHeight()
.padding(start = 6.dp)
) {
// NOT SHOW !!!
drawLine(
color = Color.White,
start = Offset(0f, 0f),
end = Offset(0f, size.height),
strokeWidth = 2f,
pathEffect = PathEffect.dashPathEffect(floatArrayOf(20f, 20f), 0f),
)
}
}
}
}

