Wajahat Karim
08/26/2020, 10:29 AMDraw
composable. I can see in previous early versions like dev07 or dev08, there used to be a Draw
composable through which we could render other composables on Canvas. I want to rotate a @Composable()
method. Old code is like this:
@Composable
fun Rotate(degree: Float, children: @Composable() () -> Unit) {
Draw(children = children) { canvas, parent ->
val halfWidth = parent.width.value / 2
val halfHeight = parent.height.value / 2
canvas.save()
canvas.translate(halfWidth, halfHeight)
canvas.rotate(degree)
canvas.translate(-halfWidth, -halfHeight)
drawChildren()
canvas.restore()
}
}
len
08/26/2020, 11:04 AMdrawLayer
modifier with a rotationZ
parameter on the view you want to rotateWajahat Karim
08/26/2020, 12:05 PM