onPressed property
void Function()?
onPressed
final
Called when the button is pressed with Enter, Space, a click, or a
semantic activate action; null disables the button. The button doesn't
wait for asynchronous work the handler starts. To decline a press, such as
when the action it runs turns out to be unavailable, throw
SemanticActionDeclined: a key press or click ignores it, and a semantic
activation reports unsupported instead of completed.
Implementation
final void Function()? onPressed;