Hugo Djemaa
Nov 22, 2023

--

Very good point, thanks !

I will change to canvas in the article, but I will also try to check the performance diff.

Edit :
In fact, Canvas is a wrapper around drawBehind :

@Composable
fun Canvas(modifier: Modifier, onDraw: DrawScope.() -> Unit) =
Spacer(modifier.drawBehind(onDraw))

So I will just add that it’s possible to use Canvas instead of drawWithContent.

--

--

Hugo Djemaa
Hugo Djemaa

Written by Hugo Djemaa

Android Engineer | ThreeLittleDev | Freelancer

Responses (2)