fun interface A2uiImageRenderer


An abstraction of an asynchronous image loader which should be implemented using the application's image loading library (such as Coil or Glide), used for rendering an image for A2uiBasicCatalogV1.Image.

Example using Coil's AsyncImage:

val imageRenderer =
A2uiImageRenderer { url, contentDescription, contentScale, modifier, onError ->
AsyncImage(
model = url,
contentDescription = contentDescription,
contentScale = contentScale,
modifier = modifier,
onError = { state -> onError(state.result.throwable) },
)
}

Summary

Public functions

Unit
@Composable
Image(
    url: String,
    contentDescription: String?,
    contentScale: ContentScale,
    modifier: Modifier,
    onError: (Throwable?) -> Unit
)

Displays an image from a URL.

Public functions

Image

@Composable
fun Image(
    url: String,
    contentDescription: String?,
    contentScale: ContentScale,
    modifier: Modifier,
    onError: (Throwable?) -> Unit
): Unit

Displays an image from a URL.

Parameters
url: String

The URL of the image to load.

contentDescription: String?

Accessibility text for the image.

contentScale: ContentScale

How the image should be scaled to fit its bounds.

modifier: Modifier

The modifier to be applied to the layout.

onError: (Throwable?) -> Unit

The callback to be invoked when the image fails to load.