TextWithColorConfigProvider - Static colors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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