Fixed
Status Update
Comments
[Deleted User] <[Deleted User]> #2
There's some code in the tracers:
com.swissborg.app.common.compose.navigation.NavigationAnimationsKt$offsetXFactor$1 in invoke-3p2s80s at line 24
com.swissborg.app.common.compose.navigation.NavigationAnimationsKt$offsetXFactor$1 in invoke at line 23
Woudl you be able to link it or provide a similar code to what you have to help us debug further? How offsetXFactor looks like as well as your custom navigation logic and how it swaps the screens
so...@google.com <so...@google.com> #3
this is how offsetXFactor looks like:
```
private fun Modifier.offsetXFactor(
offsetX: (fullWidth: Int) -> Int,
factor: Float,
): Modifier = layout { measurable, constraints ->
val placeable = measurable.measure(constraints)
layout(placeable.width, placeable.height) {
placeable.placeRelative(
x = lerp(0f, offsetX(placeable.width).toFloat(), factor).toInt(),
y = 0,
)
}
}
```
and this is how we swap the screens:
```
fun slideHorizontally(
offsetX: (fullWidth: Int) -> Int,
animationSpec: FiniteAnimationSpec<Float> = tween(),
): StackAnimator = stackAnimator(animationSpec = animationSpec) { factor, _, content ->
content(Modifier.offsetXFactor(offsetX, factor))
}
```
we use different enter/exit transition animations, i.e.
```
open fun enterTransition(): StackAnimator = slideHorizontally(
offsetX = { it },
animationSpec = tween(ScreenTransitionAnimationDuration),
)
```
```
private fun Modifier.offsetXFactor(
offsetX: (fullWidth: Int) -> Int,
factor: Float,
): Modifier = layout { measurable, constraints ->
val placeable = measurable.measure(constraints)
layout(placeable.width, placeable.height) {
placeable.placeRelative(
x = lerp(0f, offsetX(placeable.width).toFloat(), factor).toInt(),
y = 0,
)
}
}
```
and this is how we swap the screens:
```
fun slideHorizontally(
offsetX: (fullWidth: Int) -> Int,
animationSpec: FiniteAnimationSpec<Float> = tween(),
): StackAnimator = stackAnimator(animationSpec = animationSpec) { factor, _, content ->
content(Modifier.offsetXFactor(offsetX, factor))
}
```
we use different enter/exit transition animations, i.e.
```
open fun enterTransition(): StackAnimator = slideHorizontally(
offsetX = { it },
animationSpec = tween(ScreenTransitionAnimationDuration),
)
```
po...@google.com <po...@google.com> #4
I found the same error while working for my current company and it was caused by a missing CompositionLocal. In my case, I wasn't using the app theme and the error was not explicit at all with that missing implicit dependency. May that be your same case?
ap...@google.com <ap...@google.com> #5
After updating the libraries the error eventually went away. It's ok to close this issue now
Description
Component used:
ui
Version used:
1.0.0-beta05
Devices/Android versions reproduced on:
Pixel 5
I have a dialog with content that might not fit so I would like the content to wrap its content and scroll if it doesn't fit. To do this I am using
Modifier.weight(1f, fill = false)
. When placed inside the dialog however the content does wrap but the dialogs height fills the whole screen.As you can see in the screenshot there is extra space below the "cancel" button which is unexpected. If the content is placed outside of a
Dialog
it works as expected.The code in question is: