Skip to content

Instantly share code, notes, and snippets.

@rmyhal
Last active February 18, 2024 07:24
Show Gist options
  • Select an option

  • Save rmyhal/272ce38b702fde9cf1d562ca5691c4ee to your computer and use it in GitHub Desktop.

Select an option

Save rmyhal/272ce38b702fde9cf1d562ca5691c4ee to your computer and use it in GitHub Desktop.
@Composable
private fun FabContent(
modifier: Modifier = Modifier,
) {
var containerState by remember { mutableStateOf(ContainerState.Fab) }
AnimatedContent(
modifier = modifier,
targetState = containerState,
label = "container transform",
) { state ->
when (state) {
ContainerState.Fab -> Fab(
modifier = Modifier
.padding(end = 16.dp, bottom = 16.dp),
onClick = { containerState = ContainerState.Fullscreen }
)
ContainerState.Fullscreen -> AddContentScreen(
onBack = { containerState = ContainerState.Fab }
)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment