I am making a layout where a column contains up to 5 rows. Each row has three columns and I would like to have the width of the first column of each row be completely equal.
The first column in each row always takes up as much size as the text it contains, the size of the column doesn't scale to match the size of the biggest column in the list of rows.
Each row item:
fun GetRowItem(firstColumnText: String, secondColumnText: String, thirdColumnText: String) {
Row(
modifier = Modifier.padding(start = 4.dp, end = 4.dp),
verticalAlignment = Alignment.CenterVertically
) {
Column(
modifier = Modifier.padding(end = 4.dp),
) {
Text(
text = firstColumnText
)
}
Column(
modifier = Modifier.padding(end = 4.dp),
) {
Text(
text = secondColumnText
)
}
Column(
modifier = Modifier.padding(end = 4.dp),
) {
Text(
text = thirdColumnText
)
}
}
}
Then I have a parent that arranges the rows something like this:
Column(modifier = Modifier.fillMaxWidth().padding(start = 8.dp, end = 8.dp) {
GetRowItem(firstColumnText = "short", secondColumnText = "something", thirdColumnText = "something")
GetRowItem(firstColumnText = "Realy long ee", secondColumnText = "something", thirdColumnText = "something")
GetRowItem(firstColumnText = "1", secondColumnText = "something", thirdColumnText = "something")
}
The output of this is not what I am looking for and I am struggling to see how to align the columns in each row item. It looks like InstrisicSize might be an option here, but I'm not sure how to get the max size of an arbitrary column in the list of rows and apply it to each column. The image below shows what I am getting versus what I am expecting. I only want to align the first columns, the rest don't matter.
