the image of an issue is as following

the image of an issue is as following

Make sure you are using a stateful widget. Make one boolean value isSelected (False as default) and whenever the button is pressed setState the isSelected to true. Now go back to the button color and use the ternary operator.
isSelected? (New Color) : (Default Color)
Here is my sample code.
Container(
padding: EdgeInsets.symmetric(horizontal: 2, vertical: 2),
decoration: BoxDecoration(
border: Border.all(
color: foodtype == 'Veg' ? Colors.green : Colors.red,
),
),
child: Icon(
Icons.circle,
color:
foodtype == 'Veg' ? Color.fromARGB(255, 31, 177, 36) : Colors.red,
),
),