Elnur Jeksenov
02/09/2021, 3:05 PMCanvas(modifier = Modifier.fillMaxSize(),
onDraw = {
drawRect(
size = Size(packFloats(200f, 50f)),
color = Color.Blue,
style = Stroke(width = 1f, pathEffect = PathEffect.dashPathEffect(floatArrayOf(10f, 10f), 0f))
)
}
)
Have you got any idea, why this exception is appearing?Kirill Grouchnikov
02/09/2021, 3:07 PMjim
02/09/2021, 3:57 PMBenjO
02/09/2021, 4:27 PMJeisson Sáchica
02/09/2021, 4:27 PMNader Jawad
02/09/2021, 5:14 PMDrawScope
API.
val paint = remember {
Paint().apply {
color = Color.Blue
style = PaintingStyle.Stroke
strokeWidth = 1f
pathEffect = PathEffect.dashPathEffect(floatArrayOf(10f, 10f), 0f)
}
}
Canvas(modifier = Modifier.fillMaxSize()) {
drawIntoCanvas { canvas ->
canvas.drawRect(0f, 0f, 200f, 50f, paint)
}
}
Nader Jawad
02/09/2021, 5:15 PMSize(packFloats(200f, 50f)
but rather just call Size(200f, 50f)
directly. This is a side effect of how inline classes in Kotlin work. We need to expose the packed long value public constructor however, we expose similarly named function constructors to do this work on your behalf