Reputation: 1277
Recently I came across a video on YouTube regarding the announcement of flutter 1.0 (link) and I was wondering how could I implement those 150 little animated hearts(watch from 13:50 onward) in my app.
I searched the web but could not find any specific widget which could help me with the same.
Considering the fact that I'm new to flutter I'd be very glad if someone could point me in the right direction. Thanks for helping :-)
Upvotes: 0
Views: 1807
Reputation: 4346
How I would implement this is have a scroll view with a container (fixed height, and width = screenWidth) in it, with a Stack inside that. I would have all the hearts in the stack already, keep a reference to all the hearts in my stateful widget. When the heart button is tapped I'll go through each of the heart widgets and start it's animation with a random delay. So to recap:
That should make it all animate once at different times. If you want to loop them just manage that within your heart widget.
Upvotes: 1