Closed Solido closed 6 years ago
Nice one 😃. Very useful suggestion. I don't think it will be backward compatible though, if I want to keep it simple.
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) {}
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?
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.
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.
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.
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.
Available on version 0.2.0
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.