How to create an annotation that composes other annotations in kotlin for composable functions?

Viewed 352

I would like to create an annotation called @MyComposablePreview that is composed of:

@Preview(
    uiMode = Configuration.UI_MODE_NIGHT_NO,
    showBackground = true,
    name = "Light Mode"
)
@Preview(
    uiMode = Configuration.UI_MODE_NIGHT_YES,
    showBackground = true,
    name = "Dark Mode"
)
@Composable

So that I could call it in a composable function like this:

@MyComposablePreview
fun CardPreiview() {
    //Code of preview
}

Is it possible to do this in jetpack compose? I tried to use annotated classes but I couldn't :/

0 Answers
Related