I'm trying to display a linear gradient over a background image so it's easier to read the text on the image. But do to the lack of documentation it's not easy to do. I want to accomplish something like this.
Here is my component:
@Composable
override fun MakeComposable(screen: ScreenID?, onEvent: (ScreenEvent) -> Unit) {
if (screen == null) return
val gradient = Brush.linearGradient(
colors = listOf(Color.Transparent, Color.Black),
start = Offset.Zero,
end = Offset.Infinite,
tileMode = TileMode.Clamp
)
ComposeTestTheme {
Box(modifier = Modifier.background(color = MaterialTheme.colors.surface))
{
screen.backgroundImage?.let { ui.Image(ImageData(url = it), onEvent = onEvent) }
LazyColumn(horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.fillMaxSize()) {
this.items(screen.modules) { module ->
ModuleComposable(ui, module, onEvent)
}
}
}
Box(modifier = Modifier.fillMaxSize().background(gradient))
}
}