How do I disable any widget in Flutter?

Viewed 4683

In my app, I need to disable many widgets many times. But I cannot find convenient way to do so? I would appreciate your help. Thank you!

2 Answers

You can wrap any widget in flutter with the AbsorbPointer widget so that you can enable or disable the widget.

body: AbsordPointer(
  absorbing: false,
  ...
  ...
  ...
)

if you are talking about TextField widget you can set readOnly atribute to true. If its a checkBox or DropdownButton pass null for onChanged attribute.

Related