Is this a bug or is there a reason why my preview ...
# compose
a
Is this a bug or is there a reason why my preview looks different than my emulator ?
Copy code
@Composable
fun ModifierLayoutDrawing(
) {
    Canvas(modifier = Modifier
        .fillMaxHeight()
        .fillMaxWidth()
        .background(Color.Green)
        .moveDraw()
        ,
        onDraw = {
            drawCircle(color = Color.Blue, radius = 200f)
        }
    )
}

@Preview(showBackground = true)
@Composable
fun layoutPreview() {
    ModifierLayoutDrawing()
}

fun Modifier.moveDraw(): Modifier {
    return layout { measurable, constraints ->
        val place = measurable.measure(constraints = constraints)

        layout(constraints.maxWidth, constraints.maxHeight) {
            place.placeRelative(100, 0)
        }
    }
}
e
Try to remove the moveDraw modifier, see if that interferes with the whole canvas. Could be that you are moving everything.
j
API 29
🙏 1