I tried to implement the solution in this article but it's not working for me. When I click the button it should be disabled. Also, when I click the button and hot reload the app, it renders the button disabled.
I also tried using a function but I had difficulties accessing widgets variables.
bool _isButtonDisabled = false;
MaterialButton(
color: Colors.blue,
textColor: Colors.white,
disabledColor: Colors.grey,
disabledTextColor: Colors.black,
child: Text('Login'),
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(4)),
onPressed: _isButtonDisabled ? null : () async {
_isButtonDisabled = true;
// Login Stuff
}
)