-
-
Save KatieBarnett/764b4db9cebf85d497a6f0db87701906 to your computer and use it in GitHub Desktop.
LocalInspectionMode - Simple text example
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
@Composable | |
fun TextComponent() { | |
Column( | |
verticalArrangement = Arrangement.spacedBy(16.dp), | |
modifier = Modifier.padding(16.dp) | |
) { | |
Text( | |
if (LocalInspectionMode.current) { | |
"This is only displayed in a preview" | |
} else { | |
"This is only displayed in live code" | |
} | |
) | |
Text("This should always be displayed") | |
} | |
} | |
@Preview(showBackground = true) | |
@Composable | |
fun TextComponentPreview() { | |
TextComponent() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment