-
-
Save KatieBarnett/44b8a98e8f8886bc10dee602ab104375 to your computer and use it in GitHub Desktop.
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