connectedGridItemShape

fun connectedGridItemShape(index: Int, totalItems: Int, columns: Int, outerCornerRadius: Dp = DefaultStylishDimensions.connectedCornerRadius, joinedCornerRadius: Dp = DefaultStylishDimensions.joinedCornerRadius): Shape

Builds a position-aware RoundedCornerShape for the item at index in a grid-based Connected UI layout.

This is a convenience wrapper that combines connectedGridCorners and connectedShape: it computes which corners of the item face the exterior of the grid and returns a shape where those corners receive outerCornerRadius while all interior (joined) corners receive joinedCornerRadius.

Corner assignment follows the same rules as connectedGridCorners: a corner is outer only when the item has no neighbor in the two directions that meet at that corner. For example, the item at index = 0 (top-left) has no neighbor above or to the left, so its topStart corner is outer; an interior item with neighbors on every side has all joined corners. A partially filled final row is stretched to the full grid width by the Connected grid layouts, so the function treats every column of the row directly above the last row as having a neighbor below.

Return

A Shape suitable for use with Modifier.clip() or Modifier.background().

Parameters

index

Zero-based position of the item in row-major order.

totalItems

Total number of items in the grid. Must be greater than zero.

columns

Number of columns in the grid layout. Must be greater than zero.

outerCornerRadius

Radius applied to corners that face the exterior of the grid. Defaults to DefaultStylishDimensions.connectedCornerRadius (12 dp).

joinedCornerRadius

Radius applied to corners that face an adjacent item. Defaults to DefaultStylishDimensions.joinedCornerRadius (2 dp).

See also

Throws

if columns is not greater than zero, or if index is outside the range 0 until totalItems.