Skip to content

Commit

Permalink
Fix Tile width calculation when contraints.width is 0 or smaller th…
Browse files Browse the repository at this point in the history
…en the trailing icon width (#474)

Fix Tile width calculation when contraints.width is 0 or smaller then the trailing icon width
  • Loading branch information
Alex Matečný committed Jun 26, 2023
1 parent 350ee73 commit 38f7c6a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ui/src/main/java/kiwi/orbit/compose/ui/controls/TileGroup.kt
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ public fun TileGroupScope.Tile(
) { measurables, constraints ->
val trailingWidth = measurables[1].maxIntrinsicWidth(Int.MAX_VALUE)
val occupied = trailingWidth.takeIf { it != 0 }?.plus(12.dp.roundToPx()) ?: 0
val contentWidth = (constraints.maxWidth - occupied).coerceAtLeast(0)
val contentPlaceable = measurables[0].measure(
Constraints.fixedWidth(width = constraints.maxWidth - occupied),
Constraints.fixedWidth(width = contentWidth),
)
val trailingPlaceable = measurables[1].measure(
Constraints.fixed(
Expand Down

0 comments on commit 38f7c6a

Please sign in to comment.