Row(children: <Widget>[
TextButton(
style: TextButton.styleFrom(primary: battonColor_1, textStyle: TextStyle(fontSize: 18,),),
child: Text("Все"),
onPressed: () {
setState(() {
makeStuff("all", true);
});
},),
TextButton(
style: TextButton.styleFrom(primary: battonColor_2, textStyle: TextStyle(fontSize: 18,),),
child: Text("Первые блюда"),
onPressed: () {
setState(() {
makeStuff("first", false, true);
});
},),
TextButton(
style: TextButton.styleFrom(primary: battonColor_3, textStyle: TextStyle(fontSize: 18,),),
child: Text("Вторые блюда"),
onPressed: () {
setState(() {
makeStuff("second", false, false, true,);
});
},),
])
void makeStuff(stuffGroup, [batton1=false, batton2=false, batton3=false, batton4=false, batton5=false, batton6=false]) {
battonColor_1 = batton1 ? Colors.red : Colors.grey;
battonColor_2 = batton2 ? Colors.red : Colors.grey;
battonColor_3 = batton3 ? Colors.red : Colors.grey;
battonColor_4 = batton4 ? Colors.red : Colors.grey;
battonColor_5 = batton5 ? Colors.red : Colors.grey;
battonColor_6 = batton6 ? Colors.red : Colors.grey;
stuff.clear();
.........
.........
.........
}