How do I disable a Button in Flutter?

后端 未结 8 2143
不思量自难忘°
不思量自难忘° 2020-12-04 17:19

I\'m just starting to get the hang of Flutter, but I\'m having trouble figuring out how to set the enabled state of a button.

From the docs, it says to set onP

8条回答
  •  温柔的废话
    2020-12-04 17:49

    Enable and Disable functionality is same for most of the widgets.

    Ex, button , switch, checkbox etc.

    Just set the onPressed property as shown below

    onPressed : null returns Disabled widget

    onPressed : (){} or onPressed : _functionName returns Enabled widget

提交回复
热议问题