Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7e9dd498 authored by Jordan Demeulenaere's avatar Jordan Demeulenaere Committed by Automerger Merge Worker
Browse files

Fix child constraints in (Horizontal|Vertical)Grid am: 3d5bf056 am: fc59292e

parents 49e61e47 fc59292e
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.constrainWidth
import androidx.compose.ui.unit.dp
import kotlin.math.ceil
import kotlin.math.max
@@ -126,18 +125,20 @@ private fun Grid(
            ((columns - 1) * horizontalSpacing.toPx()).roundToInt()
        val totalVerticalSpacingBetweenChildren = ((rows - 1) * verticalSpacing.toPx()).roundToInt()
        val childConstraints =
            Constraints().apply {
            Constraints(
                maxWidth =
                    if (constraints.maxWidth != Constraints.Infinity) {
                    constrainWidth(
                        (constraints.maxWidth - totalHorizontalSpacingBetweenChildren) / columns
                    )
                }
                    } else {
                        Constraints.Infinity
                    },
                maxHeight =
                    if (constraints.maxHeight != Constraints.Infinity) {
                    constrainWidth(
                        (constraints.maxHeight - totalVerticalSpacingBetweenChildren) / rows
                    )
                }
                    } else {
                        Constraints.Infinity
                    }
            )

        val placeables = buildList {
            for (cellIndex in measurables.indices) {