Skip to content

An Android Studio plugin to quickly create jetpack compose preview functions

License

Notifications You must be signed in to change notification settings

EarlOfEgo/Jetpack-Compose-preview-creator

Repository files navigation

Compose Preview Function Creator

Build Version Downloads

Plugin to quickly create preview functions for composables. The plugin takes the composable function name and arguments and wraps it into a preview function, which then gets added to the end of the file. Just use the generate menu (command + enter) when your cursor is on the name of a composable function and select " Generate Compose Preview". The preview is added at the end of the file with an suffix you can configure in the settings.

Features:

  • Initializes all parameters of the composable(also classes with their constructor call)
  • Select a default visibility of the generated preview function
  • Choose if parameter names are used in the composable function call
  • Choose if the default values of a parameter are used or if the plugin should create values
  • Choose if nullable parameters are initialized with null or a value
  • Wrap the composable in a theme
  • Simple creation

    Wrap into theme

    Configure the behaviour

    Installation

    • Using the IDE built-in plugin system:

      Settings/Preferences > Plugins > Marketplace > Search for "Jetpack-Compose-preview-creator" > Install

    • Using JetBrains Marketplace:

      Go to JetBrains Marketplace and install it by clicking the Install to ... button in case your IDE is running.

      You can also download the latest release from JetBrains Marketplace and install it manually using Settings/Preferences > Plugins > ⚙️ > Install plugin from disk...

    • Manually:

      Download the latest release and install it manually using Settings/Preferences > Plugins > ⚙️ > Install plugin from disk...


    Plugin based on the IntelliJ Platform Plugin Template.