I found that it would automatically scroll several times the first time
Opened this issue · 8 comments
I obtained the data list through the backend interface, and when binding the card swiper, I found that it would automatically scroll several times the first time before stopping at the index position. This is why and how to avoid this problem, so that it should not automatically scroll a few times and directly locate at the index position the first time
when loop = true;
This is the log of index changes that I output,
Finally locate at index=2
I/flutter (23982): spwiere index , 0
I/flutter (23982): spwiere index , 0
I/flutter (23982): spwiere index , 4
I/flutter (23982): spwiere index , 4
I/flutter (23982): spwiere index , 1
I/flutter (23982): spwiere index , 1
I/flutter (23982): spwiere index , 4
I/flutter (23982): spwiere index , 2
I/flutter (23982): spwiere index , 5
I/flutter (23982): spwiere index , 5
I/flutter (23982): spwiere index , 2
I/flutter (23982): spwiere index , 5
I/flutter (23982): spwiere index , 0
I/flutter (23982): spwiere index , 3
I/flutter (23982): spwiere index , 3
I/flutter (23982): spwiere index , 5
I/flutter (23982): spwiere index , 4
I/flutter (23982): spwiere index , 0
I/flutter (23982): spwiere index , 5
I/flutter (23982): spwiere index , 2
I/flutter (23982): spwiere index , 5
I/flutter (23982): spwiere index , 0
I/flutter (23982): spwiere index , 1
I/flutter (23982): spwiere index , 5
I/flutter (23982): spwiere index , 2
I/flutter (23982): spwiere index , 3
I/flutter (23982): spwiere index , 4
I/flutter (23982): spwiere index , 5
I/flutter (23982): spwiere index , 0
I also encountered continuous scrolling when loading for the first time,
I load the component by checking if the data source is empty
hope to help you
Same problem, did you find a solution?
我第一次加载时也遇到了连续滚动的情况, 我通过检查数据源是否为空来加载组件 希望对你有帮助
按你的办法解决了,谢谢
Same problem, did you find a solution?
when the data is not null,load the widget,problem solved.
Same problem here when putting Swiper inside a Sliver widget any solution ?
Same problem here when putting Swiper inside a Sliver widget any solution ?
When the data is empty, this problem occurs. My solution is to not display the component when the data is empty. Once the data is obtained, the component can be displayed. You can use a ternary expression to check this.
遇到同样问题,首次打开,swiper那里来回跳
card_swiper:
dependency: "direct main"
description:
name: card_swiper
sha256: "0c94c538f47be1dab52d018d4900a7046b4cb0700dc7f95b8628da89d1212b35"
url: "https://pub.dev"
source: hosted
version: "2.0.4"