I have 4 buttons which is dynamically created based on list Value. consider I have button A,B,C & D. When i click button A color is changing from white to gray , When i click Button B or C or D... i want to revert the button A color to white and Also i want to change button color to gray which is clicked second time.
Anyone Please help me to achieve this.
Sample code is below
return Container(
width: double.infinity,
child: RaisedButton(
elevation: 10,
color: isOptionPressed ? Color(0x4D707070) : Color(0xFFFFFFFF),
textColor: Colors.white,
child: Text('${list[i]}',style: TextStyle(fontSize: 16, color: Colors.black)),
shape: new RoundedRectangleBorder(borderRadius: new BorderRadius.circular(50)),
splashColor: Color(0x4D707070),
onPressed:
() {
setState(() {
isOptionPressed = true;
});
},
);
Listview.builder
?