From 288fdc9369f4afe54983fd95a8fb8e91f7249021 Mon Sep 17 00:00:00 2001 From: Roberto Orgiu Date: Thu, 5 Sep 2024 18:40:33 +0200 Subject: [PATCH] Update CanonicalLayouts/list-detail-compose/app/src/main/java/com/example/listdetailcompose/ui/ListDetailSample.kt Co-authored-by: Alex Vanyo --- .../listdetailcompose/ui/ListDetailSample.kt | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/CanonicalLayouts/list-detail-compose/app/src/main/java/com/example/listdetailcompose/ui/ListDetailSample.kt b/CanonicalLayouts/list-detail-compose/app/src/main/java/com/example/listdetailcompose/ui/ListDetailSample.kt index 46b169085..26f41b8ef 100644 --- a/CanonicalLayouts/list-detail-compose/app/src/main/java/com/example/listdetailcompose/ui/ListDetailSample.kt +++ b/CanonicalLayouts/list-detail-compose/app/src/main/java/com/example/listdetailcompose/ui/ListDetailSample.kt @@ -302,18 +302,21 @@ private fun DetailContent( ) { if (definedWord != null) { - val imageModifier = Modifier.padding(horizontal = 8.dp) - if (isSmallerThanExpanded && isDetailVisible) { - with(sharedTransitionScope) { - val state = rememberSharedContentState(key = definedWord.word) - imageModifier.then( - Modifier.sharedElement( - state, - animatedVisibilityScope = animatedVisibilityScope - ) - ) - } - } + val imageModifier = Modifier + .padding(horizontal = 8.dp) + .then( + if (isSmallerThanExpanded && isDetailVisible) { + with(sharedTransitionScope) { + val state = rememberSharedContentState(key = definedWord.word) + Modifier.sharedElement( + state, + animatedVisibilityScope = animatedVisibilityScope + ) + } + } else { + Modifier + } + ) Image( painter = painterResource(id = definedWord.icon),