'Jetpack Compose function with lambda () -> Unit
I'm trying to extract a method applied on a modifier into a Composable function
TopAppBar(
modifier = Modifier
.align(Alignment.TopCenter)
.height(56.dp)
.background(
brush = Brush.verticalGradient(
colorGradient
)
)
Specifically the Brush.verticalGradient() so that I can use the gradient Composable everywhere I need and just pass the list of colors to it.
I know that I need to use a lambda expression inside the Composable function but I'm not sure how to do it.
@Composable
private fun BottomBarGradient(
content: @Composable () -> Unit) {
}
I'm pretty new in Compose. Can anyone point out a good tutorial/example for this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
