Created
March 30, 2023 20:49
-
-
Save tfaki/3db40d9e510bf045ab065db1ae84b8aa to your computer and use it in GitHub Desktop.
Modifier Then Block
This file contains hidden or 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 WithThenBlock() { | |
var isExpanded by remember { | |
mutableStateOf(true) | |
} | |
Box( | |
modifier = Modifier | |
.height(50.dp) | |
.then( | |
if (isExpanded) { | |
isExpanded = false | |
Modifier.fillMaxWidth() | |
} else { | |
Modifier.fillMaxWidth(0.5f) | |
} | |
) | |
.background(Color.Blue) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment