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

Don't know the index of the item is sliding #218

Closed
CuongNV12 opened this issue Jun 18, 2021 · 2 comments
Closed

Don't know the index of the item is sliding #218

CuongNV12 opened this issue Jun 18, 2021 · 2 comments

Comments

@CuongNV12
Copy link

I am having:

_slidableController = SlidableController(
      onSlideAnimationChanged: handleSlideAnimationChanged,
      onSlideIsOpenChanged: handleSlideIsOpenChanged,
    );
  void handleSlideIsOpenChanged(bool? isOpen) {
  }

The isOpen variable provides no specific index, i need specific index of sliding item to perform some action like change the color of current sliding item...

Please help!

@Vanessa-Berazategui
Copy link

Vanessa-Berazategui commented Jun 24, 2021

Hi all, I have the same question, I need to change the size of the item I'm sliding. How could I get it?

I saw that i could do something like this:

void _handleSlideIsOpenChanged(bool isOpen) {
    if (isOpen) {
      ValueKey key = slidableController.activeState.widget.key;
      _bloc.setOpenedSlide(isOpen, int.parse(key.value));
    } else {
      _bloc.setOpenedSlide(false, -1);
    }
  }
  }

but when you also slide another item and you have closeOnScroll: true, this method is not invoked so I can't update the new item slided.

Thank you.

@letsar
Copy link
Owner

letsar commented Jul 24, 2021

This is not the purpose of this package. You can however pass this information using an InheritedWidget, Provider, Binder, or any other state management solution.
If you can to change the color of the current sliding item you can however get the SlidableController in the Slidable's child and listen to the ratio, or action pane type.
I made a comment for doing something like this: #167 (comment)

@letsar letsar closed this as completed Jul 24, 2021
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

3 participants