AsyncImage

fun AsyncImage(model: Any?, contentDescription: String?, imageLoader: ImageLoader, modifier: Modifier = Modifier, placeholder: Painter? = null, error: Painter? = null, fallback: Painter? = error, onLoading: (AsyncImagePainter.State.Loading) -> Unit? = null, onSuccess: (AsyncImagePainter.State.Success) -> Unit? = null, onError: (AsyncImagePainter.State.Error) -> Unit? = null, alignment: Alignment = Alignment.Center, contentScale: ContentScale = ContentScale.Fit, alpha: Float = DefaultAlpha, colorFilter: ColorFilter? = null, filterQuality: FilterQuality = DefaultFilterQuality, clipToBounds: Boolean = true)

A composable that executes an ImageRequest asynchronously and renders the result.

Parameters

model

Either an ImageRequest or the ImageRequest.data value.

contentDescription

Text used by accessibility services to describe what this image represents. This should always be provided unless this image is used for decorative purposes, and does not represent a meaningful action that a user can take.

imageLoader

The ImageLoader that will be used to execute the request.

modifier

Modifier used to adjust the layout algorithm or draw decoration content.

placeholder

A Painter that is displayed while the image is loading.

error

A Painter that is displayed when the image request is unsuccessful.

fallback

A Painter that is displayed when the request's ImageRequest.data is null.

onLoading

Called when the image request begins loading.

onSuccess

Called when the image request completes successfully.

onError

Called when the image request completes unsuccessfully.

alignment

Optional alignment parameter used to place the AsyncImagePainter in the given bounds defined by the width and height.

contentScale

Optional scale parameter used to determine the aspect ratio scaling to be used if the bounds are a different size from the intrinsic size of the AsyncImagePainter.

alpha

Optional opacity to be applied to the AsyncImagePainter when it is rendered onscreen.

colorFilter

Optional ColorFilter to apply for the AsyncImagePainter when it is rendered onscreen.

filterQuality

Sampling algorithm applied to a bitmap when it is scaled and drawn into the destination.

clipToBounds

If true, clips the content to its bounds. Else, it will not be clipped.


fun AsyncImage(model: Any?, contentDescription: String?, imageLoader: ImageLoader, modifier: Modifier = Modifier, transform: (AsyncImagePainter.State) -> AsyncImagePainter.State = DefaultTransform, onState: (AsyncImagePainter.State) -> Unit? = null, alignment: Alignment = Alignment.Center, contentScale: ContentScale = ContentScale.Fit, alpha: Float = DefaultAlpha, colorFilter: ColorFilter? = null, filterQuality: FilterQuality = DefaultFilterQuality, clipToBounds: Boolean = true)

A composable that executes an ImageRequest asynchronously and renders the result.

Parameters

model

Either an ImageRequest or the ImageRequest.data value.

contentDescription

Text used by accessibility services to describe what this image represents. This should always be provided unless this image is used for decorative purposes, and does not represent a meaningful action that a user can take.

imageLoader

The ImageLoader that will be used to execute the request.

modifier

Modifier used to adjust the layout algorithm or draw decoration content.

transform

A callback to transform a new State before it's applied to the AsyncImagePainter. Typically this is used to modify the state's Painter.

onState

Called when the state of this painter changes.

alignment

Optional alignment parameter used to place the AsyncImagePainter in the given bounds defined by the width and height.

contentScale

Optional scale parameter used to determine the aspect ratio scaling to be used if the bounds are a different size from the intrinsic size of the AsyncImagePainter.

alpha

Optional opacity to be applied to the AsyncImagePainter when it is rendered onscreen.

colorFilter

Optional ColorFilter to apply for the AsyncImagePainter when it is rendered onscreen.

filterQuality

Sampling algorithm applied to a bitmap when it is scaled and drawn into the destination.

clipToBounds

If true, clips the content to its bounds. Else, it will not be clipped.