Chris Johnson
11/15/2023, 11:27 PMzt
11/15/2023, 11:47 PMTgo1014
11/16/2023, 8:41 AMChris Johnson
11/16/2023, 7:14 PMStylianos Gakis
11/17/2023, 11:10 AM<template name="prev" value="@com.hedvig.android.core.designsystem.preview.HedvigPreview
@androidx.compose.runtime.Composable
private fun Preview$NAME$() {
com.hedvig.android.core.designsystem.theme.HedvigTheme {
androidx.compose.material3.Surface(color = androidx.compose.material3.MaterialTheme.colorScheme.background) {
$NAME$($END$)
}
}
}" description="Create @Preview composable function" toReformat="true" toShortenFQNames="true">
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" />
<context />
</template>
Take this live template and copy it. Go over to your IDE at Preferences | Editor | Live Templates
, then go to AndroidComposePreview and right click and paste in there.
Replace the HedvigTheme with your own theme and HedvigPreview
with your own preview and you’re done.
HedvigPreview is this but I think in the latest alphas at least the compose libraries provide dark/light mode preview by default in the library itself, so you don’t need your own.Chris Johnson
11/20/2023, 6:54 PM