LazyRow is not painting all the items. I assign it...
# compose
p
LazyRow is not painting all the items. I assign it a fillmaxwidth(1f) modifier, and the items childrens have fillmaxwidth(0.3f) each one, but seems that LazyColumn only can paint the first one. Why? maybe it stops iterating the items when considers that the second one doesn't fit? How can this be avoided? I tought the childrens can be infinite.
Copy code
LazyRow(
        modifier = modifier
            .fillMaxWidth(1f)
            .background(Color.Yellow)
    ) {
        itemsIndexed(element.childs) { index, element ->
            Text(text = "$index", modifier.fillMaxWidth(0.3f).background(Color.Red))
element.childs contains two items, which I'm not using here to demonstrate it with a simpler way with that Text
s
This
Copy code
@Preview
@Composable
private fun Preview() {
  HedvigTheme {
    Surface(color = HedvigTheme.colorScheme.backgroundPrimary) {
      LazyRow(
        modifier = Modifier
          .fillMaxWidth(1f)
          .background(Color.Yellow)
      ) {
        itemsIndexed(List(5) { it.toString() }) { index, item ->
          BasicText(text = "#$index:$item", Modifier.fillMaxWidth(0.3f).background(Color.Red))
        }
      }
    }
  }
}
Prints this to me. So it all looks good
btw fillMaxWidth inside a horizontally scrollable container probably does not do what you expect it to. You ask it to take 0.3f weight on an otherwise infinite horizontally container. So I think it just does nothing in the end
p
ummm strange, in my case doesn't work, and fillMaxWidth(0.3f) works, forcing the text to have that width, I know for the background color of the text
try with my code
If I use your code it works too, but with my code didn't work
Copy code
itemsIndexed(element.childs) { index, element ->
    Text(text = "$index", modifier.fillParentMaxWidth(0.3f).background(Color.Red))
    Log.d("XXXX", "adding row item $index")
}
try that
element childs is a
Copy code
mutableListOf()
with two items inside
s
Idk what
modifier
is in your case, nor what your list contains. If you paste everything I can run it. btw also fishy that you are using a *mutable*list there.