Skip to content

canerkaseler/jetpack-compose-parameter-management-with-preview-parameter

Repository files navigation

How to handle parameters and use @PreviewParameter in Jetpack Compose

This repository has a Medium Article which targets to show how to handle parameters and use @PreviewParameter in Jetpack Compose UI.

Screenshot 2024-08-19 at 22 56 22

If you would like to support my work, coffee is my best friend for writing code and articles: https://buymeacoffee.com/canerkaseler ☕️

You can reach me on social media and other platforms, stay tuned: https://linktr.ee/canerkaseler 🤝

Introduction of the article

I create a basic Android application with only Jetpack Compose in this article. This app includes a basic card design which includes text, image and button. It does not contain any network request, complex UI or business logic.

Table of contents:

  1. Compose Design with Traditional Way (If you know compose, you can skip this part.)
  2. Management of parameters of compose functions in Jetpack Compose
  3. @PreviewParameter Approach in Compose Preview
  4. References

Note: Table of contents may not show bonus parts 🎁

Example images of the results

Screenshot of the component preview from android studio.

Screenshot 2024-08-19 at 22 56 22

Screenshot of Home Screen preview from android studio.

Screenshot 2024-08-19 at 23 01 17

More details

If you would like to continue reading and learn some details about above parts, please check out the Medium Article. I hope, this repository and its Medium article will be useful and beneficial for your project! 🙌