Вам нужно отключить все остальные, чтобы добиться желаемого поведения. Составьте список значений, которые вы хотите обновить для каждого индекса кнопки:
List values = [[5,5,10,10], [3,2,3,-5], [3,-1,3,4], [3,-8, 12,1]];
Затем обновите ваш выбор:
onPressed: (int index) {
setState(() {
for (int buttonIndex = 0; buttonIndex < isSelected.length; buttonIndex++) {
if (buttonIndex == index) {
isSelected[buttonIndex] = !isSelected[buttonIndex];
if(isSelected[buttonIndex]){
_choiceA += values[buttonIndex][0];
_choiceB += values[buttonIndex][1];
_choiceC += values[buttonIndex][2];
_choiceD += values[buttonIndex][3];
}else{
_choiceA -= values[buttonIndex][0];
_choiceB -= values[buttonIndex][1];
_choiceC -= values[buttonIndex][2];
_choiceD -= values[buttonIndex][3];
isSelected[buttonIndex] = false;
}
} else {
if(isSelected[buttonIndex]){
_choiceA -= values[buttonIndex][0];
_choiceB -= values[buttonIndex][1];
_choiceC -= values[buttonIndex][2];
_choiceD -= values[buttonIndex][3];
isSelected[buttonIndex] = false;
}
}
}
});
},
Редактировать: Этот код должен быть реорганизован