diff --git a/CanonicalLayouts/list-detail-compose/app/build.gradle b/CanonicalLayouts/list-detail-compose/app/build.gradle index 4314c4f8d..f69934db4 100644 --- a/CanonicalLayouts/list-detail-compose/app/build.gradle +++ b/CanonicalLayouts/list-detail-compose/app/build.gradle @@ -68,7 +68,7 @@ dependencies { implementation "com.google.accompanist:accompanist-adaptive:0.32.0" implementation 'androidx.core:core-ktx:1.13.1' implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.4' - implementation 'androidx.activity:activity-compose:1.9.1' + implementation 'androidx.activity:activity-compose:1.9.2' implementation "androidx.compose.foundation:foundation:1.6.8" implementation "androidx.compose.ui:ui:1.6.8" implementation "androidx.compose.ui:ui-tooling-preview" 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 cd7c76138..46b169085 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 @@ -252,21 +252,18 @@ private fun ListContent( .fillMaxWidth() ) { Row { - val imageModifier = - if (isSmallerThanExpanded && !isDetailVisible) { - with(sharedTransitionScope) { - val state = rememberSharedContentState(key = word.word) - Modifier - .padding(horizontal = 8.dp) - .sharedElement( - state, - animatedVisibilityScope = animatedVisibilityScope - ) - - } - } else { - Modifier.padding(horizontal = 8.dp) + val imageModifier = Modifier.padding(horizontal = 8.dp) + if (isSmallerThanExpanded && !isDetailVisible) { + with(sharedTransitionScope) { + val state = rememberSharedContentState(key = word.word) + imageModifier.then( + Modifier.sharedElement( + state, + animatedVisibilityScope = animatedVisibilityScope + ) + ) } + } Image( painter = painterResource(id = word.icon), @@ -305,18 +302,17 @@ private fun DetailContent( ) { if (definedWord != null) { - val imageModifier = if (isSmallerThanExpanded && isDetailVisible) { + val imageModifier = Modifier.padding(horizontal = 8.dp) + if (isSmallerThanExpanded && isDetailVisible) { with(sharedTransitionScope) { val state = rememberSharedContentState(key = definedWord.word) - Modifier - .padding(horizontal = 8.dp) - .sharedElement( + imageModifier.then( + Modifier.sharedElement( state, animatedVisibilityScope = animatedVisibilityScope ) + ) } - } else { - Modifier.padding(horizontal = 8.dp) } Image(