Skip to main content
Version: 12.10.0

OCImageURLLoader

The OCImageURLLoader is a composable function in Jetpack Compose that creates a customizable UI component for displaying an image in your Android application.

Parameters:

  • modifier: A Modifier that can be applied to the WebView, which specifies various layout and behavior customizations, such as padding or alignment.
  • imageComposable: This is a composable function that will be displayed inside the OCImageURLLoader. This function is intended to handle image retrieval and display within the loader.
  • onCloseClick: A function that is executed when the 'Close' icon is clicked.

Usage

 @Composable
fun OCImageURLLoaderPreview() {
val imageUrl = ""

OCImageURLLoader(
modifier = Modifier,
imageComposable = {
// custom image loading composable. For example, using Coil:
Image(
painter = rememberCoilPainter(request = imageUrl),
contentDescription = "My image description",
modifier = Modifier.fillMaxSize(),
)
},
onCloseClick = { /* handle the close click in here */ }
)
}

Details

This function creates a UI component with a container for displaying an image and a close button at the top right corner for dismissing the image view.

The imageComposable is expected to be a Composable function that handles image loading and rendering. This allows you to decide how you would like to load and display the image (e.g., using Coil, Glide, etc).

The onCloseClick function is a callback function that is called when the user clicks on the close button. This is intended for you to decide what happens when the user decides to close the image view.