Kazemihabib1996
03/04/2020, 5:58 PMContainer(width = 400.dp, height = 400.dp) {
Clip(shape = RoundedCornerShape(20.dp)) {
Draw { canvas, parentsize ->
val outer = Rect(10f, 10f, 100f, 100f)
canvas.drawRect(outer, paint)
}
}
}
Zach Klippenstein (he/him) [MOD]
03/04/2020, 6:10 PMClip
uses its parent’s bounds, not its child:
https://kotlinlang.slack.com/archives/CJLTWPH7S/p1581336136434700?thread_ts=1581040037.376000&cid=CJLTWPH7SKazemihabib1996
03/04/2020, 6:38 PMSurface(color = Color.Blue) {
Container(width = 200.dp, height = 200.dp) {
Clip(shape = RoundedCornerShape(10.dp)) {
Draw { canvas, parentsize ->
val outer = Rect.fromCircle(Offset(200f, 200f), radius = 100f)
canvas.drawRect(outer, paint)
}
}
}
}
produces the below image