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

How do I get a current Index #90

Open
rajvarasdiya opened this issue Apr 25, 2022 · 1 comment
Open

How do I get a current Index #90

rajvarasdiya opened this issue Apr 25, 2022 · 1 comment

Comments

@rajvarasdiya
Copy link

rajvarasdiya commented Apr 25, 2022

My concern is how do I get a currentIndex, while user is scrolling.

I saw on AutoScrollController we don't get a index, will you please tell me how can I get a current Index ??

@LinXunFeng
Copy link

LinXunFeng commented Apr 11, 2023

You can use flutter_scrollview_observer to observe ScrollView, it will tell you which items are being displayed and thus know the currentIndex from resultModel.firstChild?.index.

ListViewObserver(
  child: _buildListView(),
  onObserve: (resultModel) {
    print('firstChild.index -- ${resultModel.firstChild?.index}');
    print('displaying -- ${resultModel.displayingChildIndexList}');
  },
)

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

2 participants