brianegan / brianegan/flutter_architecture_samples

Redux Listview rebuild all TodoList, but only repaint one TodoItem

Open
#175 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
8.9k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

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](https://youtu.be/kn0EOS-ZiIc?t=172), 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](https://user-images.githubusercontent.com/19588517/74606275-127e2080-510a-11ea-9de3-703a8d96349f.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.