To disable a Button in Flutter, we can simply give the onpressed: parameter a null value. This will disable the button. Something like this will work:-
RaisedButton(
onPressed: null,
child: Text('Button disabled')
);
But our button will be of no use like this. Instead, a better approach is to create a helper function that returns true/false based on the conditions and enables/disables the button accordingly. For example, pushing a button once to log in and then the button gets disabled. Code would be somewhat like this:-
RaisedButton(
onPressed: HelperFunctionToToggleButton() ? null :
onButtonPressedFunction(),
child: Text('Button disabled/enabled')
);