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?
I have used a combination of readOnly and enableInteractiveSelection properties to achieve the desired behavior on TextField.
TextField(
readOnly: true,
enableInteractiveSelection: true,
onTap: () {
do_something(),
},
)
With enableInteractiveSelection set to true, it will allow onTap() to function as normal.