Hi, first that all, I'm from Mexico, sorry for my bad English.
Selector<MenuSpotifyNotifier, Tuple2<int, String>>( selector: (_, d) => Tuple2(d.currentPos, d.titles[pos]), builder: (_, d, __) { int cPos = d.item1; String textIcon = d.item2; FaIcon icon = disabledIcon; bool isSelected = cPos == pos; if (isSelected) icon = enabledIcon; Log.console('Rebuild the UI in $textIcon'); return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ IconButton( icon: icon, onPressed: () => Provider.of<MenuSpotifyNotifier>(context, listen: false) .setCurrentPos(pos), ), Text( textIcon, style: TextStyle( color: isSelected ? Colors.white : Colors.grey, fontSize: 11.5), ) ], ); }, );
This code is for change the state when an item is pressed so the Log.console method show me when a item is rebuild. What I expect? If the item 0 is pressed this only should be rebuild, but that is not the case. All the items are rebuild.
Here an example:
dev-to-uploads.s3.amazonaws.com/i/...
Am I doing something wrong? Or Is this the behavior expected?
For the selector, theoratically it should change only if d.currentPos or d.titles[pos] changes
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi, first that all, I'm from Mexico, sorry for my bad English.
This code is for change the state when an item is pressed so the Log.console method show me when a item is rebuild. What I expect? If the item 0 is pressed this only should be rebuild, but that is not the case. All the items are rebuild.
Here an example:
dev-to-uploads.s3.amazonaws.com/i/...
Am I doing something wrong? Or Is this the behavior expected?
For the selector, theoratically it should change only if d.currentPos or d.titles[pos] changes