-
-
Save KatieBarnett/4469f9cccfcf93448b3bb11179de2a74 to your computer and use it in GitHub Desktop.
ComplexModifierScene - Second Conditional
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun ComplexModifierScene( | |
nighttime: Boolean, | |
torchon: Boolean, | |
modifier: Modifier = Modifier | |
) { | |
val backgroundColor = if (nighttime && torchon) { | |
TorchLight | |
} else if (!nighttime) { | |
Sunlight | |
} else { | |
Night | |
} | |
val boxModifier = modifier | |
.conditional(nighttime && torchon, { | |
clip(CircleShape) | |
}) | |
.fillMaxHeight() | |
.aspectRatio(1f) | |
.background(backgroundColor) | |
.conditional(nighttime, { | |
conditional( | |
condition = torchon, | |
ifTrue = { | |
shadow(elevation = 4.dp, shape = CircleShape) | |
}, | |
ifFalse = { | |
blur(20.dp) | |
} | |
) | |
}) | |
Box(boxModifier) { | |
Image(painterResource(R.drawable.outline_yard_24), "Scene", Modifier.fillMaxSize()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment