0
votes

Here is my code kindly tell me what I should do

''' Container( height: 200, child: ListView.builder( scrollDirection: Axis.horizontal, physics: BouncingScrollPhysics(), itemCount: list.length, shrinkWrap: true, itemBuilder: (context, i) { return InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => Fencyfunc( image: list[i].toString(), ))); }, child: Padding( padding: const EdgeInsets.only(left:8.0), child: Container( decoration: BoxDecoration(color: Colors.white), height: 200, width: 150, child: Stack( children: [ Image.network(list[i],fit: BoxFit.fitHeight,), Positioned( right: 5, top: 5, child: IconButton( icon: Icon(Icons.favorite), onPressed: () { saveToMyList(list[i]);

                                              setState(() {
                                                istrue1 = !istrue1;
                                                istrue2 = !istrue2;
                                              });
                                            },
                                            color: !istrue1 && istrue2
                                                ? Colors.grey
                                                : !istrue2 && istrue1
                                                    ? Colors.red
                                                    : Colors.grey)),

                                ]
                            )
                        ),
                      ),
                    );}
              ),
            ),  '''
1
tell me what I should do - answer for you as much detailed as question: fix this. post more codesnachmsm
Post the code for the list that got changed.Victor Eronmosele
I edit my code you can see full code nowRude Gal

1 Answers

0
votes

Add index in setState method so it will favourite only on particular index only