Skip to content

Instantly share code, notes, and snippets.

@KatieBarnett
Last active May 9, 2023 11:07
Embed
What would you like to do?
TextWithColorConfigProvider - Static colors
class TextWithColorConfigProvider : PreviewParameterProvider<TextConfig> {
override val values: Sequence<TextConfig> = sequenceOf(
TextConfig(color = Color.Red, text = "Primary text"),
TextConfig(color = Color.Blue, text = "Secondary text")
)
}
@Preview
@Composable
fun TextColoredComponentPreview(
@PreviewParameter(TextWithColorConfigProvider::class) data: TextConfig
) {
MaterialTheme {
Text(data.text, color = data.color)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment