In the below code, toPx() works in Canvas but not in Surface.
Why?
Canvas(modifier = Modifier.size(16.dp)) {
val textPaint = Paint().asFrameworkPaint().apply {
textSize = 32.dp.toPx()
}
}
Surface(modifier = Modifier.size(16.dp)) {
val textPaint = Paint().asFrameworkPaint().apply {
textSize = 32.dp.toPx() // Error `toPx()`
}
}