英文:
Jetpack Compose Material3 Pull to Refresh functionality
问题
我正在尝试根据这个指南,从Material2规范迁移项目到Material 3 Compose库。
Material2中的当前LazyColumn已经整合了下拉刷新功能,在这里找到。
然而,在Material3中,我没有找到类似的功能。
有一个问题跟踪器在这里,但他们说这个功能将仅在今年中期考虑,这太长时间了。
有没有人对如何处理这种情况有任何想法?下拉刷新是我们应用程序用户流程中重要的步骤,所以没有它不是一个选择。
我们是否应该使用accompanist/swipeToRefresh
,即使它已经不推荐使用了?
我还不擅长编写自定义Compose组件,所以如果有人能帮助我解决这个问题,我会很感激。
英文:
I am trying to migrate a project from Material2 specs to Material 3 compose library following this guide.
The current LazyColumn in Material2 has integrate Pull to refresh functionality, found here
However, i did not find any such functionality for Material3.
There is an issue tracker open here but they say this functionality will be considered only mid this year, which is too long to wait.
Does anyone have any idea on how this situation should be handled? Pull to refresh is an important flow of our apps user flow, so not having it is not an option.
Should we use accompanist/swipeToRefresh
even though it is deprecated?
I am not proficient in writing custom compose components yet, so any help in figuring this out would be appreciated
答案1
得分: 17
我们的团队也遇到了同样的问题。最终,我们选择将PullToRefresh组件的MD2实现作为临时解决方案引入我们的项目中,然后将所有MD2的引用更新为它们的MD3版本。
完整的MD2实现包括以下文件:
- PullRefresh.kt
- PullRefreshIndicator.kt
- PullRefreshIndicatorTransform.kt
- PullRefreshState.kt
这种方法是在这个讨论中建议的。你可以在这里找到帖子作者的完整解决方案here。
英文:
Our team ran into this same problem. Ultimately, we opted to bring the MD2 implementation of the PullToRefresh component into our project as a temporary workaround. Then, we just updated any MD2 references to their MD3 counterparts.
The full MD2 implementation consists of the following files:
- PullRefresh.kt
- PullRefreshIndicator.kt
- PullRefreshIndicatorTransform.kt
- PullRefreshState.kt
This approach was suggested in this discussion. You can find the op's full solution here.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论