brianegan / flutter_architecture_samples

TodoMVC for Flutter
http://fluttersamples.com/
BSD 3-Clause "New" or "Revised" License
8.74k stars 1.71k forks source link

Redux Listview rebuild all TodoList, but only repaint one TodoItem #175

Open WingCH opened 4 years ago

WingCH commented 4 years ago

Hi, i am learning Redux, your sample is very helpful.

But I have some questions and hope to answer them...

In redux sample, when i click Checkbox, StoreConnector(FilteredTodos) will return whole TodoList, ListView.builder(TodoList) will rebuild all TodoItem, so i thinks the all TodoItem should be rebuilded.

However, in reality, when i open Flutter inspector - Repaint Rainbow this can Shows rotating colors on layers when repainting., according to photo only TodoItem that are clcik will be repainted.

I tried deleting 'key', but the result is the same.

In When to Use Keys - Flutter Widgets 101 Ep. 4, Statless Widget only will compared the type and key to update widget, I don't know why it only rebuild one TodoItem rather than all 'TodoItem'.

image