'Android Compose Text Can we have two different texts set to the start and to the end of parent using same Text() field?

I am trying to use just one Text composable and have two different texts displayed to the start of the parent and to the end of the parent. Is there a recommended way of doing it? I was looking at the official documentation for Text composable and I could only find that using "buildAnnotatedString", we can have multiple texts vertically stacked on top of each other with the help of withStyle and lineHeight. But I am trying to do something like this:Total $40 But "Total" should be all the way to the left and "$40" should be all the way to the right.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source