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

Is it possible to collapse DragAndDropListExpanion on external event / trigger? #91

Open
cougardev opened this issue Jul 3, 2023 · 2 comments

Comments

@cougardev
Copy link

Lets say you have multiple to do lists.
Is there a way to make to DragAndDropListExpanion collapse as soon as a certain event occurs?
(e.g. all to do's of the list are checked).
Unfortunately the list doesn't rebuild once the 'initiallyExpanded' variable changes from the outside.

Suggestions are highly appreciated. Thanks

@rubinbasha
Copy link

I am also in need of this feature. I was honestly taking it for granted that the feature was already working like this, but sadly it is not.

@rubinbasha
Copy link

rubinbasha commented Dec 10, 2024

@cougardev after doing some thinking I see a way to achieve this.
What you have to do is keep a local reference in memory List sectionTiles = [];
Preferably in the State object of the widget and then you can call .expand .collapse on items.
In my implementation when I get a call to build according to state change or framework reason, I first check if I have the DragAndDropListExpansion object in the list, based on the key I assign to it in creation time.

@philip-brink
there is a bug though in the library and that is related to just an exclamation mark ! that should not be there in the .collapse() function. since this is a very small fix, do you by any chance think you can solve and merge this quickly?

`
@ override
toggleExpanded() {
if (isExpanded) {
collapse();
} else {
expand();
}
}

@ override
collapse() {
if (!isExpanded) {
_expanded.value = false;
_expansionKey.currentState!.collapse();
}
}

@ override
expand() {
if (!isExpanded) {
_expanded.value = true;
_expansionKey.currentState!.expand();
}
}
`

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