Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.x shared element prototype #1

Open
wants to merge 29 commits into
base: 1.x
Choose a base branch
from

Conversation

KovalevAndrey
Copy link
Owner

Description

...

Check list

  • I have updated CHANGELOG.md if required.
  • I have updated documentation if required.

Comment on lines 47 to 76
Box(
modifier = modifier
.requiredSize(200.dp)
.clickable {
onProfileClick(pageId)
}
) {
val profile = Profile.allProfiles[pageId]
ProfileImage(
profile.drawableRes, modifier = Modifier
.fillMaxSize()
.sharedElementWithCallerManagedVisibility(
sharedContentState = rememberSharedContentState(key = "$pageId image"),
visible = isSharedElementVisible
)
)
Text(
text = "${profile.name}, ${profile.age}",
color = Color.White,
fontSize = 16.sp,
modifier = Modifier
.fillMaxWidth()
.sharedElementWithCallerManagedVisibility(
sharedContentState = rememberSharedContentState(key = "$pageId text"),
visible = isSharedElementVisible
)
.align(Alignment.BottomStart)
.padding(8.dp)
)
}

Check warning

Code scanning / detekt

Modifiers should only be used once and by the root level layout of a Composable. This is true even if appended to or with other modifiers e.g. 'modifier.fillMaxWidth()'. Use Modifier (with a capital 'M') to construct a new Modifier that you can pass to other composables. See https://mrmans0n.github.io/compose-rules/rules/#dont-re-use-modifiers for more information. Warning

Modifiers should only be used once and by the root level layout of a Composable. This is true even if appended to or with other modifiers e.g. 'modifier.fillMaxWidth()'. Use Modifier (with a capital 'M') to construct a new Modifier that you can pass to other composables. See https://mrmans0n.github.io/compose-rules/rules/#dont-re-use-modifiers for more information.
Comment on lines 36 to 80
LazyRow(
modifier = modifier.fillMaxSize(),
contentPadding = PaddingValues(horizontal = 16.dp),
horizontalArrangement = Arrangement.spacedBy(32.dp),
verticalAlignment = Alignment.CenterVertically
) {
repeat(10) { pageId ->
item(key = pageId) {
val sharedScope = LocalSharedElementScope.current
sharedScope.apply {
val isSharedElementVisible by LocalSharedElementVisibility.current
Box(
modifier = modifier
.requiredSize(200.dp)
.clickable {
onProfileClick(pageId)
}
) {
val profile = Profile.allProfiles[pageId]
ProfileImage(
profile.drawableRes, modifier = Modifier
.fillMaxSize()
.sharedElementWithCallerManagedVisibility(
sharedContentState = rememberSharedContentState(key = "$pageId image"),
visible = isSharedElementVisible
)
)
Text(
text = "${profile.name}, ${profile.age}",
color = Color.White,
fontSize = 16.sp,
modifier = Modifier
.fillMaxWidth()
.sharedElementWithCallerManagedVisibility(
sharedContentState = rememberSharedContentState(key = "$pageId text"),
visible = isSharedElementVisible
)
.align(Alignment.BottomStart)
.padding(8.dp)
)
}
}
}
}
}

Check warning

Code scanning / detekt

Modifiers should only be used once and by the root level layout of a Composable. This is true even if appended to or with other modifiers e.g. 'modifier.fillMaxWidth()'. Use Modifier (with a capital 'M') to construct a new Modifier that you can pass to other composables. See https://mrmans0n.github.io/compose-rules/rules/#dont-re-use-modifiers for more information. Warning

Modifiers should only be used once and by the root level layout of a Composable. This is true even if appended to or with other modifiers e.g. 'modifier.fillMaxWidth()'. Use Modifier (with a capital 'M') to construct a new Modifier that you can pass to other composables. See https://mrmans0n.github.io/compose-rules/rules/#dont-re-use-modifiers for more information.
@KovalevAndrey KovalevAndrey force-pushed the 1.x-shared-element-prototype branch 5 times, most recently from 79e5f36 to 56485aa Compare April 30, 2024 14:29
KovalevAndrey and others added 5 commits May 2, 2024 11:38
Co-authored-by: Manuel Vivo <manuelvicnt@gmail.com>
Co-authored-by: Manuel Vivo <manuelvicnt@gmail.com>
…e/Children.kt

Co-authored-by: Manuel Vivo <manuelvicnt@gmail.com>
Co-authored-by: Manuel Vivo <manuelvicnt@gmail.com>
- Moved LocalMovableContentMap to Children composable and added a parameter to it.
- Added support for more movableContent API variants
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant