David Edwards
10/21/2020, 1:35 PMfillMaxHeight
set. The sibling does not grow to fill the new height of its parent. I have made a gif to illustrate what I mean, the sibling is highlighted blue. If I set the Row to a fixed height, the issue does not happen.David Edwards
10/21/2020, 1:35 PMRow(
modifier = Modifier.fillMaxHeight()
) {
// This composable will cause the Row to grow to the size of the image
CoilImage(data = "<https://picsum.photos/id/15/400/700>")
Spacer(modifier = Modifier.width(8.dp))
// This composable will start out fitting to the height of the
// text (since there is nothing yet loaded to compare with). Once
// the image is rendered, the box will not continue to fill the space.
Box(
modifier = Modifier.fillMaxSize()
.background(Color.Blue)
) {
Text(
text = "This is an example"
)
}
}
David Edwards
10/21/2020, 1:35 PMZach Klippenstein (he/him) [MOD]
10/21/2020, 2:18 PMbackground
before fillMaxSize
?Zach Klippenstein (he/him) [MOD]
10/21/2020, 2:19 PMfillMaxHeight
on the Row
? It looks like your rows are in a scrollable list, which measure height as unbounded, which I think means fillMaxSize
is ignored (if it weren’t ignored, you’d only see one row there and the image size wouldn’t affect it at all).David Edwards
10/21/2020, 2:21 PMZach Klippenstein (he/him) [MOD]
10/21/2020, 2:23 PMDavid Edwards
10/21/2020, 2:23 PMLazyColumnForIndexed
to be specific.Zach Klippenstein (he/him) [MOD]
10/21/2020, 2:25 PMZach Klippenstein (he/him) [MOD]
10/21/2020, 2:27 PMDavid Edwards
10/21/2020, 2:33 PMZach Klippenstein (he/him) [MOD]
10/21/2020, 2:35 PMval outerInvalidate = invalidate
Row(…) {
val innerInvalidate = invalidate
CoilImage(…)
…
LaunchedTask {
while(isActive) {
delay(100)
outerInvalidate()
innerInvalidate()
}
}
}
Zach Klippenstein (he/him) [MOD]
10/21/2020, 2:36 PMModifier.height(300.dp)
or something), do the other siblings get laid out correctly then?Zach Klippenstein (he/him) [MOD]
10/21/2020, 2:39 PMDavid Edwards
10/21/2020, 3:27 PMval outerInvalidate = invalidate
Row {
val innerInvalidate = invalidate
// This composable will cause the Row to grow to the size of the image
CoilImage(
data = "<https://picsum.photos/id/15/400/700>",
loading = {
Box(
Modifier
.width(100.dp)
.height(300.dp)
.background(Color.Red)
) {
CircularProgressIndicator()
}
}
)
Spacer(modifier = Modifier.width(8.dp))
// This composable will start out fitting to the height of the
// text (since there is nothing yet loaded to compare with). Once
// the image is rendered, the box will not continue to fill the space.
Box(
modifier = Modifier
.fillMaxSize()
.background(Color.Blue)
) {
Text(
text = "This is an example"
)
}
LaunchedTask {
while (isActive) {
delay(100)
Timber.v("TEST")
outerInvalidate()
innerInvalidate()
}
}
}
Even with both in action.Zach Klippenstein (he/him) [MOD]
10/21/2020, 3:33 PMBox
with a custom layout and put breakpoints/log statements in the measureblocks lambda to see if the layout is even being triggeredDavid Edwards
10/21/2020, 3:48 PMZach Klippenstein (he/him) [MOD]
10/21/2020, 3:50 PMLayout(children = { Box(Modifier) }) { _, _ ->
println("LAYOUT")
layout(0, 0) {}
}
David Edwards
10/21/2020, 4:33 PMZach Klippenstein (he/him) [MOD]
10/21/2020, 4:34 PMLayout(children = { Box(Modifier) }) { _, constraints ->
println("LAYOUT: $constraints")
layout(0, 0) {}
}
David Edwards
10/21/2020, 6:37 PMMyBox: LAYOUT 79895555 Constraints(minWidth = 0, maxWidth = 1328, minHeight = 0, maxHeight = Infinity)
MyBox: LAYOUT 79895555 Constraints(minWidth = 0, maxWidth = 978, minHeight = 0, maxHeight = Infinity)
MyBox: LAYOUT 79895555 Constraints(minWidth = 0, maxWidth = 928, minHeight = 0, maxHeight = Infinity)
Zach Klippenstein (he/him) [MOD]
10/21/2020, 6:41 PMDavid Edwards
10/21/2020, 6:44 PMZach Klippenstein (he/him) [MOD]
10/21/2020, 6:48 PMDavid Edwards
10/22/2020, 1:52 PM