Hello all, having problems trying to set the heigh...
# compose
b
Hello all, having problems trying to set the height of a Row to the full height based on its childrens height. If you can take a peek, thanks in advance. Code in comments
Copy code
Row {
   Box(Modifier
      .width(20.dp)
      .height(IntrinsicSize.Min)
      .background(Color.Black)
   )

   Column {
      HorizontalPagerIndicator(
         pagerState = pagerState,
         modifier = Modifier
            .align(Alignment.CenterHorizontally)
            .padding(bottom = 16.dp),
      )

      HorizontalPager(
         count = mapAnnotations.size,
         state = pagerState,
         contentPadding = PaddingValues(horizontal = 0.dp),
         modifier = Modifier.fillMaxWidth(),
      ) { page ->
         Column(
            modifier = Modifier
               .fillMaxWidth()
               .weight(1f)
         ) {
         
         }
      }
   }
}
However I am not seeing the Box with the black background. This is in a bottom sheet and if I set the height to fillMaxHeight() the height is much taller than the content. Not sure why
Copy code
.height(IntrinsicSize.Min)
is not working
l
What happens if you use IntrinsicSize.Max? The min size should be 0 for the box, right?
Or you could use fillMaxHeight on the Box like the divider in https://developer.android.com/jetpack/compose/layouts/intrinsic-measurements
b
InstristicSize.Max does not seem to make a difference. And the problem with using fillMaxHeight on the Box is that the max height of the parent (since it is a bottom sheet) is much bigger than the size of the content the children take up.
Fairly certain my issue form checking the docs is that the IntrinsicSize.Min needs to be on the top level Row, since that contains the children with dynamic height. However when doing that I get the following error message:
Asking for intrinsic measurements of SubcomposeLayout layouts is not supported.
t
Currently this is not supported. You need to write your custom layout to measure the children and set the parent height accordingly
469 Views