Skip to content

Instantly share code, notes, and snippets.

@fvilarino
Created April 20, 2024 23:46
Show Gist options
  • Save fvilarino/cc271417d5ae3867e02adeb437b8689b to your computer and use it in GitHub Desktop.
Save fvilarino/cc271417d5ae3867e02adeb437b8689b to your computer and use it in GitHub Desktop.
Shared Elem - Details Text
@Composable
fun SharedTransitionScope.DetailsScreen(
url: String,
animatedVisibilityScope: AnimatedVisibilityScope,
onClick: () -> Unit,
modifier: Modifier = Modifier,
) {
Column(
modifier = modifier
.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = null,
onClick = onClick
),
verticalArrangement = Arrangement.spacedBy(16.dp)
) {
AsyncImage(
model = url,
modifier = Modifier
.fillMaxWidth()
.aspectRatio(4f / 3f)
.sharedElement(
rememberSharedContentState(key = "image-$url"),
animatedVisibilityScope,
),
contentDescription = null,
)
LoremIpsum(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp)
// 1
.sharedElement(
rememberSharedContentState(
key = "text-$url"
),
animatedVisibilityScope,
)
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment