Created
November 8, 2022 09:12
-
-
Save cp-radhika-s/4d370cd6958e9f990995929f17305d57 to your computer and use it in GitHub Desktop.
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 ExampleTextString() { | |
val textMeasure = rememberTextMeasurer() | |
Canvas(modifier = Modifier | |
.fillMaxWidth() | |
.height(100.dp), onDraw = { | |
drawRect(color = Color.Black) | |
drawText( | |
textMeasurer = textMeasure, text = "Text on Canvas!", | |
style = TextStyle( | |
fontSize = 35.sp, | |
brush = Brush.linearGradient( | |
colors = RainbowColors | |
) | |
), | |
topLeft = Offset(20.dp.toPx(), 20.dp.toPx()) | |
) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment