Reputation: 481
I would like to build a list with ListView.builder of stateful widget.
I am building a social network app and I have a list of posts. Every post has a like button so when I press it, it should be updated in every screen.
So I would like to wrap every post (that is an item in the listview) in a post bloc that can handle the like operation and update itself accordingly.
I don't know if this can be an heavy pattern and if the list will somehow make explode the smartphone of the users.
Upvotes: 3
Views: 2339
Reputation: 54365
Question : if it’s a good practice to put StatefulWidgets as items of a listview
Yes.
example of social network app, You can reference Instagram clone with 215 Stars
https://github.com/mohak1283/Instagram-Clone
Chat screen contains listview
https://github.com/mohak1283/Instagram-Clone/blob/master/lib/ui/chat_screen.dart
Chat Detail screen is a StatefulWidget https://github.com/mohak1283/Instagram-Clone/blob/master/lib/ui/chat_detail_screen.dart
Upvotes: 0