-
-
Save philipplackner/3d3b900d2e9128a37d7d5e6e8fac9e4f to your computer and use it in GitHub Desktop.
1. hiltvm (applicable in top-level) | |
@dagger.hilt.android.lifecycle.HiltViewModel | |
class $NAME$ @javax.inject.Inject constructor( | |
$PARAM$ | |
) : androidx.lifecycle.ViewModel() { | |
$END$ | |
} | |
2. vmstatefunc (applicable in class) | |
private val _$NAME$ = androidx.compose.runtime.mutableStateOf<$TYPE$>($INITIAL_VALUE$) | |
val $NAME$: androidx.compose.runtime.State<$TYPE$> = _$NAME$ | |
fun $FUNC$($PARAM$: $TYPE$) { | |
_$NAME$.value = $PARAM$ | |
} | |
3. remstate (applicable in Kotlin except Comment) | |
var $NAME$ by androidx.compose.runtime.remember { | |
androidx.compose.runtime.mutableStateOf($INITIAL_VALUE$) | |
} | |
4. centerbox (applicable in Kotlin except Comment) | |
androidx.compose.foundation.layout.Box( | |
modifier = androidx.compose.ui.Modifier.fillMaxSize(), | |
contentAlignment = androidx.compose.ui.Alignment.Center | |
) { | |
$END$ | |
} | |
5. iconbtn (applicable in Kotlin except Comment) | |
androidx.compose.material.IconButton( | |
onClick = { | |
}, | |
) { | |
androidx.compose.material.Icon( | |
imageVector = $ICON$, | |
contentDescription = $CONTENT_DESCRIPTION$ | |
) | |
} |
This is great Philipp! thanks a bunch
modifier = androidx.compose.ui.Modifier
.$NAME$
For those who find it annoying to write modifier=Modifier repeatedly...like me.
Thanks, Philipp.
tnku sir <3
Thanks Philipp very very helpful
Thanks! Very helpful
Thanks!
Arigato!
Thanks!
I added to compose also:
'fmh' -> modifier = androidx.compose.ui.Modifier.fillMaxHeight()
'fmw' -> modifier = androidx.compose.ui.Modifier.fillMaxWidth()
'fms' -> modifier = androidx.compose.ui.Modifier.fillMaxSize()
'mmm' -> modifier: androidx.compose.ui.Modifier = Modifier
'mm' -> modifier = androidx.compose.ui.Modifier.$FUN$
Very Helpful. Thank you Philipp!
You're amazing Philipp! Thanks
A Great Help. Thanks A Lot -_-
Thanks Philipp!
Thank you. very handy tool!
Amazing! Thanks!
Amazing! Thanks!
amazin, thank you very much
They are so awesome Philip! Thanks a lot.