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();
.........
.........
.........
}
Упрощённый пример, вдруг кому пригодится.
qFindData.predicate = QueryPredicate("dateIn between @variable1 and @variable2 OR dateOut between @variable1 and @variable2", {
"variable1": DateTime.parse('2024-05-01 14:00:00.000z'),
"variable2": DateTime.parse('2024-05-11 12:00:00.000z')
});