Fixed
Status Update
Comments
cl...@google.com <cl...@google.com>
lp...@google.com <lp...@google.com> #2
Hi,
It's about a some fix for FAB. The problem is AnimatedVisibility
default animation expandIn
include ChangeSize
and it's default value is IntSize(0, 0)
. When it size was Zero, the FAB doesn't draw when recomposition. If this bug comes from production, you can fix it like below.
var flag by remember { mutableStateOf(true) }
Scaffold(
floatingActionButton = {
AnimatedVisibility(
visible = flag,
enter = fadeIn() + expandIn { IntSize(width = 1, height = 1) })
{
FloatingActionButton(onClick = {}) {
Icon(Icons.Default.ArrowBack, null)
}
}
},
) {
Switch(flag, { flag = it })
}
Chage:
ma...@google.com <ma...@google.com> #3
expandIn { IntSize ...
fix works, but has the same problem as with wrapping AnimatedVisibility
in fixed size Box
: the shadow is cropped during the transition, as can be seen in the withBox.gif
attached to original post.
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit 3658fbf9f31f7efe35ecc726fe6cbffbd07b4373
Author: Cagdas Caglak <cagdascaglak@gmail.com>
Date: Mon Apr 04 10:01:41 2022
Fix AnimatedVisibility issue with FloatingActionButton in Scaffold
With scaffold change which I mentioned below, it breaks the fab button has 0 size. androidx.compose.animation.TransitionData has ChangeSize data and if enter animation has (0, 0) initialSize(it's default at animations), affected change is eliminating zero size fab component when recomposition runs.
Bug: 224005027
Relnote: "Fix AnimatedVisibility issue with FloatingActionButton in Scaffold"
Affected ChangeId: I4e80378133be73fdb1700daf7a1bc926504a7611
Test: Run "androidx.compose.material.ScaffoldTest#scaffold_geometry_animated_fabSize" test
Change-Id: I3a0aec281af02a829375aeb2ca4474cbf1eb05a5
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ScaffoldTest.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Scaffold.kt
https://android-review.googlesource.com/2052969
Branch: androidx-main
commit 3658fbf9f31f7efe35ecc726fe6cbffbd07b4373
Author: Cagdas Caglak <cagdascaglak@gmail.com>
Date: Mon Apr 04 10:01:41 2022
Fix AnimatedVisibility issue with FloatingActionButton in Scaffold
With scaffold change which I mentioned below, it breaks the fab button has 0 size. androidx.compose.animation.TransitionData has ChangeSize data and if enter animation has (0, 0) initialSize(it's default at animations), affected change is eliminating zero size fab component when recomposition runs.
Bug: 224005027
Relnote: "Fix AnimatedVisibility issue with FloatingActionButton in Scaffold"
Affected ChangeId: I4e80378133be73fdb1700daf7a1bc926504a7611
Test: Run "androidx.compose.material.ScaffoldTest#scaffold_geometry_animated_fabSize" test
Change-Id: I3a0aec281af02a829375aeb2ca4474cbf1eb05a5
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ScaffoldTest.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Scaffold.kt
Description
Android Studio Build: 4.1 Canary 8
Version of Gradle Plugin: 4.1.0-alpha08
Version of Gradle: 6.3
Version of Java: 1.8
Compose Version: 0.1.0-dev10
When checked,
Switch
thumbs show the color palette secondary color, as expected. However, when unchecked, the thumbs completely blend into the surface they are on top of. This occurs on both light and dark theme palettes (screenshots attached).