Status Update
Comments
co...@google.com <co...@google.com>
co...@google.com <co...@google.com>
na...@google.com <na...@google.com> #2
@ezio1497@gmail.com Could you please insert the code snippet that you've used?
Meanwhile I tried a few examples. If we change the layout direction by changing the locale (or setting the developer option "Force RTL layout direction"), it works. But if instead we set the layout direction via the ambient (Providers (LayoutDirectionAmbient provides LayoutDirection.Rtl) { Popup() }
), then the layout direction won't be propagated to the content of the Popup
If I understand correctly, the value of the layout direction set via ambient should have been propagated. So it seems like there is an issue with the ambient. Below is the minimum repro:
- Define a new ambient
val MyAmbient = ambientOf<Int>()
- Use it for Popup content size
Providers(MyAmbient provides 200) {
Popup(alignment = Alignment.CenterStart) {
val sizeDp = with(DensityAmbient.current) { MyAmbient.current.toDp() }
Box(Modifier.preferredSize(sizeDp).background(Color.Gray))
}
}
-
Run example and notice the result - Popup size is 200
-
Set the value of MyAmbient in ProvideCommonAmbients to 10
internal fun ProvideCommonAmbients(...) {
Providers(
...,
MyAmbient provides 10,
children = content
)
}
- Rerun using the same code snippet from step 2 and notice that the Popup size becomes 10. So even though we provided 200 on step 2, the content of the Popup still uses the one set on step 4.
Chuck, could you please take a look?
Description
Snapshot: 12284019
It looks like velocity is not used in pane expansion so, regardless of how fast you fling, it will animate to the nearest anchor the moment the pointer up happens. It would be nice to take into account the velocity for both the animation and deciding the anchor to move to.
Attached is an example with anchors at 0, 25%, 50%, 75%, and 100%. It shows that you can carefully drag to either end and it works as expected but flings just stop abruptly at the nearest point.