Home > OS >  setState method reload listview. How can i block it? Flutter
setState method reload listview. How can i block it? Flutter

Time:12-18

I'm using cardview on listview. And cardView has a icon.I wanna change icon color. When i click icon ,color is changed very well but whole listView is reloaded and goes to top of the listView. How can i change icon color withot refreshing listView?

CodePudding user response:

connect the color to a variable and on an event change the variable using an terinary function then setState on the stateful widget.

CodePudding user response:

Widgets vs helper method. enter link description here

Here you can make a separate widget. That should be a stateful class. Otherwise, you can use any state management.

  • Related