resizeWithContentScale

Functions summary

Modifier
@UnstableApi
Modifier.resizeWithContentScale(
    contentScale: ContentScale,
    aspectRatio: Float?,
    alignment: Alignment
)

Attempts to size the original content rectangle to be inscribed into a destination by applying a specified ContentScale type.

Functions

Modifier.resizeWithContentScale

@UnstableApi
fun Modifier.resizeWithContentScale(
    contentScale: ContentScale,
    aspectRatio: Float?,
    alignment: Alignment = Alignment.Center
): Modifier

Attempts to size the original content rectangle to be inscribed into a destination by applying a specified ContentScale type.

Parameters
contentScale: ContentScale

The ContentScale to apply to the content.

aspectRatio: Float?

The aspect ratio of the content (width / height). If null, no scaling is applied.

alignment: Alignment = Alignment.Center

The Alignment used to position the scaled content within the destination. If the scaled content overflows the destination, e.g. with ContentScale.Crop, the alignment determines which part of the content lies within the destination.