Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I found that it would automatically scroll several times the first time #73

Open
zjypp opened this issue Jun 8, 2023 · 8 comments
Open

Comments

@zjypp
Copy link

zjypp commented Jun 8, 2023

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

@PostLiu
Copy link

PostLiu commented Jun 13, 2023

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

@ljhao24
Copy link

ljhao24 commented Aug 28, 2023

Same problem, did you find a solution?

@qpc2015
Copy link

qpc2015 commented Aug 31, 2023

我第一次加载时也遇到了连续滚动的情况, 我通过检查数据源是否为空来加载组件 希望对你有帮助

按你的办法解决了,谢谢

@TheLittleMatch
Copy link

Same problem, did you find a solution?

when the data is not null,load the widget,problem solved.

@khang-dev
Copy link

Same problem here when putting Swiper inside a Sliver widget any solution ?

@TheLittleMatch
Copy link

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.

@hc2088
Copy link

hc2088 commented Mar 26, 2024

遇到同样问题,首次打开,swiper那里来回跳
card_swiper:
dependency: "direct main"
description:
name: card_swiper
sha256: "0c94c538f47be1dab52d018d4900a7046b4cb0700dc7f95b8628da89d1212b35"
url: "https://pub.dev"
source: hosted
version: "2.0.4"

@zjypp
Copy link
Author

zjypp commented Mar 26, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants