Search code examples
kotlinandroid-jetpack-composecompose-desktopjetbrains-compose

How do I wrap text around an image or a composable?


How do I wrap text around an image or a composable?
Something similar to FlowTextView in Jetpack Compose.

I am wondering if there is a possibility to leave a certain space free so that if the text is too long it breaks a line and writing continues underneath the free space completely normally without the space being overwritten.

I have this:

enter image description here

I want to do this:

enter image description here

I try to do this with compose for desktop but should be the same as with android jetpack compose.
I do not know if it is, for now, possible but I can't find a way to manipulate the Text composable.
Found PlaceHolder and TextLayoutInput but i don't know how to use it. Maybe impossible.


Solution

  • Putting images inside text can be done using AnnotatedString and inlineContent parameter of Text Composable.

    How adding ImageSpan in jetpack compose Text