What i want to do in flutter is when i press button1 it enables button2 and then it disables himself and i want to do the same for button2.
bool button1 = true;
bool button2 = false;
void _button1(){
setState(){
button1=false;button2=true;
}
}
void _button2(){
setState(){
button1=true;button2=false;
}
}
new MaterialButton(onPressed: button1 ? _button1 :null,child: Text("button1"),color: Colors.greenAccent,),
new MaterialButton(onPressed: button2 ? _button2 :null,child: Text("button2"),color: Colors.greenAccent,),
But it's not working for me, because when i press button1 nothing happens.