Created
January 18, 2024 14:14
-
-
Save abhishektiwarijr/91d6be50400efdb60d8dcf5fb93aee5c to your computer and use it in GitHub Desktop.
Compose Live Templates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<templateSet group="Compose"> | |
<template name="compb-fms" value="import androidx.compose.foundation.layout.fillMaxSize @androidx.compose.runtime.Composable fun $NAME$() { androidx.compose.foundation.layout.Box( modifier = androidx.compose.ui.Modifier.fillMaxSize() ) { $END$ } }" description="Composable with a Box Parent with modifier fillMaxSize" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="KOTLIN" value="true" /> | |
<option name="KOTLIN_COMMENT" value="false" /> | |
</context> | |
</template> | |
<template name="compb-fmw" value="import androidx.compose.foundation.layout.fillMaxWidth @androidx.compose.runtime.Composable fun $NAME$() { androidx.compose.foundation.layout.Box( modifier = androidx.compose.ui.Modifier.fillMaxWidth() ) { $END$ } }" description="Composable with a Box Parent with modifier fillMaxWidth" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="KOTLIN" value="true" /> | |
<option name="KOTLIN_COMMENT" value="false" /> | |
</context> | |
</template> | |
<template name="compc-fms" value="import androidx.compose.foundation.layout.fillMaxSize @androidx.compose.runtime.Composable fun $NAME$() { androidx.compose.foundation.layout.Column( modifier = androidx.compose.ui.Modifier.fillMaxSize() ) { $END$ } }" description="Composable with a Column Parent with modifier fillMaxSize" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="KOTLIN" value="true" /> | |
<option name="KOTLIN_COMMENT" value="false" /> | |
</context> | |
</template> | |
<template name="compc-fmw" value="import androidx.compose.foundation.layout.fillMaxWidth @androidx.compose.runtime.Composable fun $NAME$() { androidx.compose.foundation.layout.Column( modifier = androidx.compose.ui.Modifier.fillMaxWidth() ) { $END$ } }" description="Composable with a Column Parent with modifier fillMaxWidth" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="KOTLIN" value="true" /> | |
<option name="KOTLIN_COMMENT" value="false" /> | |
</context> | |
</template> | |
<template name="compr-fms" value="import androidx.compose.foundation.layout.fillMaxSize @androidx.compose.runtime.Composable fun $NAME$() { androidx.compose.foundation.layout.Row( modifier = androidx.compose.ui.Modifier.fillMaxSize() ) { $END$ } }" description="Composable with a Row Parent with modifier fillMaxSize" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="KOTLIN" value="true" /> | |
<option name="KOTLIN_COMMENT" value="false" /> | |
</context> | |
</template> | |
<template name="compr-fmw" value="import androidx.compose.foundation.layout.fillMaxWidth @androidx.compose.runtime.Composable fun $NAME$() { androidx.compose.foundation.layout.Row( modifier = androidx.compose.ui.Modifier.fillMaxWidth() ) { $END$ } }" description="Composable with a Row Parent with modifier fillMaxWidth" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="KOTLIN" value="true" /> | |
<option name="KOTLIN_COMMENT" value="false" /> | |
</context> | |
</template> | |
<template name="lazyc" value="@androidx.compose.runtime.Composable fun $NAME$() { val lazyListState = androidx.compose.foundation.lazy.rememberLazyListState() androidx.compose.foundation.lazy.LazyColumn( modifier = androidx.compose.ui.Modifier .fillMaxWidth() .wrapContentHeight(), state = lazyListState ) { items($DATA$) { $END$ } } }" description="LazyColumn with fillMaxWidth and wrapContentHeight with Lazy List State" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="DATA" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="KOTLIN" value="true" /> | |
<option name="KOTLIN_COMMENT" value="false" /> | |
</context> | |
</template> | |
<template name="lazyr" value="@androidx.compose.runtime.Composable fun $NAME$() { val lazyListState = androidx.compose.foundation.lazy.rememberLazyListState() androidx.compose.foundation.lazy.LazyRow( modifier = androidx.compose.ui.Modifier .fillMaxWidth() .wrapContentHeight(), state = lazyListState ) { items($DATA$) { $END$ } } }" description="LazyRow with fillMaxWidth and wrapContentHeight with Lazy List State" toReformat="true" toShortenFQNames="true"> | |
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" /> | |
<variable name="DATA" expression="" defaultValue="" alwaysStopAt="true" /> | |
<context> | |
<option name="KOTLIN" value="true" /> | |
<option name="KOTLIN_COMMENT" value="false" /> | |
</context> | |
</template> | |
</templateSet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Linux : ~/.config/Google/AndroidStudio
Mac : ~/Library/Application\ Support/Google/AndroidStudio/templates
Windows: C:\Users\YourUserName\AppData\Roaming\Google\AndroidStudio
Example : ~/Library/Application\ Support/Google/AndroidStudio2022.3/templates
Then Just Restart Android Studio.
Note: If you can't see templates folder, create one at the specified location and then paste the file.