lazt omen
05/07/2022, 1:27 AMColumn(modifier = modifier.background(Magenta20)) {
val scrollState = rememberLazyListState(0)
val widths = playerState.showColumns.map {
<http://40.mu|40.mu>
}
val rowColors = listOf(White, Gray10)
LazyRow(state = scrollState, modifier = Modifier.weight(1F).fillMaxWidth().background(Orange20)) {
item {
Column(
modifier = Modifier.background(Green20).fillParentMaxWidth()
) {
Row(modifier = Modifier.fillMaxWidth().background(Yellow20)) {
for (column in playerState.showColumns.indices) {
Text(
playerState.showColumns[column],
style = LocalTextStyle.current.copy(fontWeight = FontWeight.Bold),
modifier = Modifier.width(widths[column])
)
}
}
LazyColumn(modifier = Modifier.weight(1F).fillMaxWidth().background(Magenta70)) {
items(20) {
Row(modifier = Modifier.fillParentMaxWidth().background(color = rowColors[it % 2])) {
for (column in playerState.showColumns.indices) {
Text(
"Value of column $it",
modifier = Modifier.width(widths[column])
)
}
}
}
}
}
}
}
val scrollbarAdapter = ScrollbarAdapter(scrollState)
HorizontalScrollbar(adapter = scrollbarAdapter)
}
The main Idea is to have a lazy row to make my content scrollable horizontally. Inside a column that contains the header and a lazy column that contains every row of data. I want my rows to be at least as wide as the screen but grow bigger if they need to. If I remove fillParentMaxWidth
from the first column my container won't expand to the entire screen. However, if I leave it, the content will shrink to match the current window width. I need the content to be as wide as it needs and at least as wide as the window. Does anyone have a solution to this?