Disable a text edit field in flutter

后端 未结 11 1579
深忆病人
深忆病人 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:27

    Use readOnly:true is correct. But if you still want focus to this text field you can follow below code:

    TextFormField(
      showCursor: true,//add this line
      readOnly: true
    )
    

提交回复
热议问题