Skip to content

Instantly share code, notes, and snippets.

@KatieBarnett
Last active May 9, 2023 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KatieBarnett/bbbd7594ecd9e2bff9a21155d4333325 to your computer and use it in GitHub Desktop.
Save KatieBarnett/bbbd7594ecd9e2bff9a21155d4333325 to your computer and use it in GitHub Desktop.
TextColoredComponentPreview - data created inside composable
@Preview
@Composable
fun TextColoredComponentPreviewDataCreatedInside() {
val previewData = sequenceOf(
TextConfig(color = MaterialTheme.colorScheme.primary, text = "Primary text"),
TextConfig(color = MaterialTheme.colorScheme.secondary, text = "Secondary text")
)
MaterialTheme {
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
previewData.forEach {data ->
Text(data.text, color = data.color)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment