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 to control the index from another widget? #51

Open
xabhinavanand opened this issue Sep 2, 2020 · 1 comment
Open

how to control the index from another widget? #51

xabhinavanand opened this issue Sep 2, 2020 · 1 comment

Comments

@xabhinavanand
Copy link

I want to add a slider which can control the index of the card. Can you please help me with that??

@BRTZL
Copy link
Contributor

BRTZL commented Sep 2, 2020

You can't directly change index after render. But by using async example you can rerender with given list of data.

So at start you have a list with length of 10, and you want to show third item. You can remove items at index 1 and 2 and you only left with list which starts at third item. So all we need to do is get a sublist from index to length of original list.

For example

List<dynamic> list;

// for going given index
void changeIndex(int index) {
    _streamController.add(list.sublist(index, list.length));
}

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