Skip to content

levinzonr/jetpack-compose-ui-arch-plugin

Repository files navigation

Jetpack Compose UI Architecture Plugin

Build AndroidWeekly As Seen In - jetc.dev Newsletter Issue #178

Jetpack Compose UI Architecture Plugin provides a set of templates that to make the development of new Jetpack Compose features faster.

Feels like something is missing or can be improved? Please submit a

To learn more about the architecture and templates are based on it, you can check following sources

New Feature Dialog

This dialog allows you to create several files related to Jetpack Compose UI Architecture. After you provide a name for your feature, plugin will generate following:

  • [featname] - package (lowercased) (optional)
    • [FeatName]Contract - contains UIState, Actions emitted from the UI layer
    • [FeatName]Screen - Basic, stateless, UI of your Screen
    • [FeatName]Coordinator - Main State holder of the Screen, controls the screen UI logic and Interactions
    • [FeatName]Route - Main entry point, tied to Coordinator and delegates all the Actions to it, Emits Screen
    • [FeatName]ViewModel - Basic implementation of your ViewModel
    • [FeatName]StatePreviewParameterProvider - Basic setup for the PreviewParameterProvider to use in Screen Preview (optional)

Live Templates

Along with the templates provided with the Dialogs, this plugin also provides several live templates. There are currently two groups of Live Templates available: Compose Foundation and UI Arch

Compose Foundation Live Templates

This set of templates contains most commonly used layouts and effects that can be used in any project

  • col -> Create Composable Column with pre-defined Modifier and Arrangement
  • row-> Create Composable Row with pre-defined Modifier and Arrangement
  • box -> Create Composable Box with Modifier
  • laun -> Create Launched Effect with Unit Key
  • disp -> Create Disposable Effect with Unit Key and onDispose Prepared

Compose UI Arch Live Templates

Currently, has only one template, that operates similar to the New Component Dialog

  • compon -> Creates new Compose UI Component with the Modifier as the parameter and a Preview\
  • ppp -> Creates a new PreviewParameterProvider setup

New Component Dialog

New component dialog simply allows you to create new Jetpack Compose UI Component a bit quicker. It will generate simple component with the Modifier as the parameter and Preview setup for you.