I tried to align the text at start of screen inside the text button but for some reason I cannot do it. It aligns the text at center of Text Button no matter what.
TextButton(
onClick = { /*TODO*/ },
modifier = Modifier
.fillMaxWidth()
) {
Text(
text = "Option A",
style = MaterialTheme.typography.bodySmall,
textAlign = TextAlign.Start,
modifier = Modifier
)
}
>Solution :
The content of a (Text)Button is by default put into a Row with horizontalArrangement = Arrangement.Center. You can make your Text aligned to the start by making it fill the whole width of that Row, for example with Modifier.weight(1F).