I am trying to get a preview of a composable which takes one String parameter as input. I am not sure how the @PreviewParameter
annotation is supposed to be used.
This is was I tried
class DogProvider : PreviewParameterProvider<String> {
override val values = listOf("Bela", "Stalone").asSequence()
}
@PreviewParameter(DogProvider::class)
@Composable
fun OverviewCard(
dog: String,
modifier: Modifier = Modifier
) {
Text(dog)
}
No preview is rendered. If I also add the @Preview
annotation it says that I should use @PreviewParameter
PreviewParameterProvider
implementation must be public, otherwise preview will not display anything. Not even an error. – Frauenfeld