Disable a text edit field in flutter

后端 未结 11 1589
深忆病人
深忆病人 2020-12-23 17:05

I need to disable TextFormField occasionally. I couldn\'t find a flag in the widget, or the controller to simply make it read only or disable. What is the best way to do it?

11条回答
  •  滥情空心
    2020-12-23 17:15

    TextField and TextFormField both have an argument called enabled. You can control it using a boolean variable. enabled=true means it will act as an editing text field whereas enabled=false will disable the TextField.

提交回复
热议问题