|
|
|
@ -34,6 +34,7 @@ import androidx.compose.ui.graphics.Color
|
|
|
|
|
import androidx.compose.ui.tooling.preview.Preview
|
|
|
|
|
import androidx.compose.ui.unit.Dp
|
|
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
|
|
import com.google.samples.apps.nowinandroid.core.designsystem.theme.GradientColors
|
|
|
|
|
import com.google.samples.apps.nowinandroid.core.designsystem.theme.LocalBackgroundTheme
|
|
|
|
|
import com.google.samples.apps.nowinandroid.core.designsystem.theme.LocalGradientColors
|
|
|
|
|
import com.google.samples.apps.nowinandroid.core.designsystem.theme.NiaTheme
|
|
|
|
@ -69,23 +70,23 @@ fun NiaBackground(
|
|
|
|
|
* of a [Box] within a [Surface].
|
|
|
|
|
*
|
|
|
|
|
* @param modifier Modifier to be applied to the background.
|
|
|
|
|
* @param topColor The top gradient color to be rendered.
|
|
|
|
|
* @param bottomColor The bottom gradient color to be rendered.
|
|
|
|
|
* @param containerColor The container color over which the gradient will be rendered.
|
|
|
|
|
* @param gradientColors The gradient colors to be rendered.
|
|
|
|
|
* @param content The background content.
|
|
|
|
|
*/
|
|
|
|
|
@Composable
|
|
|
|
|
fun NiaGradientBackground(
|
|
|
|
|
modifier: Modifier = Modifier,
|
|
|
|
|
topColor: Color = LocalGradientColors.current.top,
|
|
|
|
|
bottomColor: Color = LocalGradientColors.current.bottom,
|
|
|
|
|
containerColor: Color = LocalGradientColors.current.container,
|
|
|
|
|
gradientColors: GradientColors = LocalGradientColors.current,
|
|
|
|
|
content: @Composable () -> Unit
|
|
|
|
|
) {
|
|
|
|
|
val currentTopColor by rememberUpdatedState(topColor)
|
|
|
|
|
val currentBottomColor by rememberUpdatedState(bottomColor)
|
|
|
|
|
val currentTopColor by rememberUpdatedState(gradientColors.top)
|
|
|
|
|
val currentBottomColor by rememberUpdatedState(gradientColors.bottom)
|
|
|
|
|
Surface(
|
|
|
|
|
color = if (containerColor == Color.Unspecified) Color.Transparent else containerColor,
|
|
|
|
|
color = if (gradientColors.container == Color.Unspecified) {
|
|
|
|
|
Color.Transparent
|
|
|
|
|
} else {
|
|
|
|
|
gradientColors.container
|
|
|
|
|
},
|
|
|
|
|
modifier = modifier.fillMaxSize()
|
|
|
|
|
) {
|
|
|
|
|
Box(
|
|
|
|
|