Andre Theilacker
12/01/2022, 10:10 PM@Stable
object TopLastAtMiddleArrangement : Arrangement.Vertical {
override fun Density.arrange(
totalSize: Int,
sizes: IntArray,
outPositions: IntArray
) {
var currentOffset = 0
sizes.forEachIndexed { index, size ->
if (index == sizes.lastIndex) {
val remaining = totalSize - currentOffset - size
outPositions[index] = if (remaining > 0) (remaining / 2) + currentOffset else currentOffset
} else {
outPositions[index] = currentOffset
currentOffset += size
}
}
}
}
I was hoping to make an implementation able to, when there is space, expand the given item to fill the gap. I was hoping to be able to do that by changing the sizes array, but that didn't seem to work.
Any ideas/suggestions?