DEV Community

Cover image for A brief but cool example of some advanced Jetpack Compose. The FlowRow
Tristan Elliott
Tristan Elliott

Posted on

A brief but cool example of some advanced Jetpack Compose. The FlowRow

Table of contents

  1. Introduction
  2. Resources
  3. The FlowRow()
  4. The Interesting part

My app on the Google play store

Introduction

  • This blog post will give you a demonstration of what can be done when someone has a advanced understanding of the Jetpack compose system. I won't go into details about the advanced topics of Jetpack compose (specifically because I don't have a good understanding of them). However, I will give you a demonstration of something cool(FlowRow) that was created by someone who has a deep understanding of the advanced topics in jetpack compose. I will also give you resources if you wish to read more about these topics.

Resources

The FlowRow()

  • So I made this UI where the little tags at the bottom were created via a FlowRow(). HERE is the code:
FlowRow(
            modifier = Modifier.background(Color.Transparent).padding(bottom = 10.dp)
        ) {
            tags.forEach { tagTitle ->
                VerticalTagText(tagTitle)
            }
        }
Enter fullscreen mode Exit fullscreen mode
  • Here is the UI: depicting the FlowRow
  • Notice how the tags(Cozy, GoodVibes, SFW, ect...) at the bottom, automatically wrap. This is very useful but it makes me curious.... how is it doing this?

The Interesting part

  • The interesting part of the FlowRow() is when we look at the source code, HERE. We can see on THIS line that the compose team is creating a custom measure policy . Which is a part of the compose lifecycle, specifically the measuring phase.

  • I find all this so interesting because we can read about How Jetpack Compose Measuring Works and see a real life implementation and it gets used by a ton of people!!!!!! Finally a real work example!!!!!

  • Very cool right?!?!?! I love a good practical example. Ok thats it for me, happy coding :)

Conclusion

  • Thank you for taking the time out of your day to read this blog post of mine. If you have any questions or concerns please comment below or reach out to me on Twitter.

Top comments (0)