Sean Proctor
03/12/2024, 10:17 PMSean Proctor
03/12/2024, 10:38 PM@Composable
fun ConditionalContainer(
condition: Boolean,
trueContainer: @Composable (content: @Composable (Modifier) -> Unit) -> Unit,
falseContainer: @Composable (content: @Composable (Modifier) -> Unit) -> Unit,
content: @Composable (Modifier) -> Unit
) {
val movableContent = remember(content) { movableContentOf(content) }
if (condition) {
trueContainer(movableContent)
} else {
falseContainer(movableContent)
}
}
the keys to the remember should also include condition
because the passed in modifier changes. For some reason this bug only shows up when it's inside another container.