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

ItemBuilder for animated SlideAction #1

Closed
Solido opened this issue Jul 21, 2018 · 8 comments
Closed

ItemBuilder for animated SlideAction #1

Solido opened this issue Jul 21, 2018 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@Solido
Copy link

Solido commented Jul 21, 2018

So the idea would be using an itemBuilder for SlideAction that mimics the AnimatedList so we can access the Animation when creating the child. This way I can also animate Opacity in my case.

@letsar
Copy link
Owner

letsar commented Jul 21, 2018

Nice one 😃. Very useful suggestion. I don't think it will be backward compatible though, if I want to keep it simple.

@letsar letsar self-assigned this Jul 21, 2018
@letsar letsar added the enhancement New feature or request label Jul 21, 2018
@Solido
Copy link
Author

Solido commented Jul 21, 2018

If you don't want to break the current API you can use the same trick than color property on Container.

You can set color field only if decoration field is not present.

Maybe you can keep child under SlideAction but make it invalid if this part is not present

builder : (Context c, Animation a) {}

@letsar
Copy link
Owner

letsar commented Jul 22, 2018

What I had in mind about breaking changes, was more about custom slidable delegate. If I want to keep the API simple, I will only expose the builders, and not the widget list anymore for slidable actions.
I'm planning to work on this today on another branch.
Once I have something working, would you mind telling me what you think?

@Solido
Copy link
Author

Solido commented Jul 22, 2018

Show me the code when it's done ! It's already in my project, should be straightforward to tell you how the API 'feels' and if I can reach the required effect on my app.

@letsar
Copy link
Owner

letsar commented Jul 22, 2018

You can checkout the branch feature/1_itembuilder to see the code.

I added a new constructor, called Slidable.builder that allows you to set left and right SlidableActionDelegate.
There are two SlidableActionDelegate, one for supporting List<Widget> if we don't care about animation. The other, called SlidableActionBuilderDelegate for the enhancement you are proposing.

I modified my example if you want an example which opacifies the slidable actions while the list item is sliding.

Let me know what you think about this API.

@Solido
Copy link
Author

Solido commented Jul 22, 2018

I really love the API, when you getting confortable with builder you want them anywhere.
It is transparent with the rest of the Flutter API and the effect I wanted is implemented easily.
What is great is that I can reuse the same code that what I use in AnimatedList.

@letsar
Copy link
Owner

letsar commented Jul 22, 2018

Ok great 😄 . I will add some documentation and merge it into the master branch. But I will wait to finish #2 before publishing a new version if you don't mind.

@letsar
Copy link
Owner

letsar commented Jul 22, 2018

Available on version 0.2.0

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

No branches or pull requests

2 participants