Skip to content

A collection of snippets to reduce the development time in Jetpack Compose

Notifications You must be signed in to change notification settings

ilyasipek/jetpack-compose-snippets-plugin

Repository files navigation

Jetpack Compose Snippets

A live-template collection to save time writing the boilerplate in Compose.


Available Snippets Overview

Note: Live-template variable $VAR_NAME$ is a placeholder within a live template that enables you to dynamically inserts values when expanding the template.

Shortcut Code
box Box($MODIFIER$) { }
column Column($MODIFIER$) { }
row Row($MODIFIER$) { }
txt Text(text = $TEXT$) { }
scf Scaffold { innerPadding -> }
scfTopbar Scaffold(topBar = { $TOP_BAR$ } ) { innerPadding -> }
hspacer Spacer(modifier = Modifier.width($PADDING$))
vspacer Spacer(modifier = Modifier.height($PADDING$))
mv modifier = Modifier.
mp modifier: Modifier = Modifier
sr stringResource(id = R.string.$RESOURCE_ID$)
pr painterResource(id = R.drawable.$RESOURCE_ID$)
rmfs remember { mutableFloatStateOf($INITIAL_VALUE$) }
rmis remember { mutableIntStateOf($INITIAL_VALUE$) }
rms remember { mutableStateOf($INITIAL_VALUE$) }
le LaunchedEffect($KEY$ (default Unit)) { }
le2 LaunchedEffect($KEY1$, $KEY2$)) { }
de DisposableEffect($KEY$) { onDispose {} }
de2 DisposableEffect($KEY1$, $KEY2$) { onDispose {} }
statehoisting $VALUE_NAME$: $TYPE$, on$CAPETLIZED_VALUE_NAME$Change: ($TYPE$) -> Unit,
slot $NAME$: @Composable () -> Unit,
mc MaterialTheme.colorScheme.$COLOR$
ms MaterialTheme.shapes.$SHAPE$
mt MaterialTheme.typography.$TYPOGRAPHY$
rcs val coroutineScope = rememberCoroutineScope()
rlc val context = LocalContext.current
rld val density = LocalDensity.current

Setup 🔨

Option1: Copy and Past to Your IDE

  1. Copy all the live-templates from this gist
  2. Create a new live-template group by going to Settings -> Editor -> Live templates -> + Template Group
  3. Right-click on the Template group then click past or just CTRL + V/ CMD + V
  4. Done ✅

Option2: Install Jetpack-Compose Snippets Plugin (Coming Soon)

... coming soon...

About

A collection of snippets to reduce the development time in Jetpack Compose

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages