ImageBlock

fun <T> ImageBlock(title: String, load: suspend () -> T, painterFor: @Composable (T) -> Painter, contentScaleFor: @Composable (T) -> ContentScale = { ContentScale.Crop }, modifier: Modifier = Modifier, downloadButtonVisible: Boolean = true, downloadButtonVisibleFor: @Composable (T) -> Boolean = { downloadButtonVisible }, clickableFor: @Composable (T) -> Boolean = { true }, onDownloadButtonClick: () -> Unit, onShareButtonClick: () -> Unit)

DHIS2 Image Block. Wraps compose Image.

Parameters

title

controls the text to be shown for the title

load

to load an image stored in the resource, device memory or from network we can use loadPainter, loadImageBitmap, loadSvgPainter or loadXmlImageVector

painterFor

is a composable function which controls how to paint the load param,

contentScaleFor

is a composable function which controls how to scale the painted image.

modifier

allows a modifier to be passed externally

downloadButtonVisible

controls whether the download button is visible or not

downloadButtonVisibleFor

is a composable function which controls whether the download button is visible or not for the loaded item, defaults to downloadButtonVisible.

clickableFor

is a composable function which controls whether the image can be tapped to open full screen, defaults to always clickable.

onDownloadButtonClick

is a callback to notify when the download button is clicked.

onShareButtonClick

is a callback to notify when the share button is clicked.