Reputation: 8859
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.
Upvotes: 11
Views: 18628
Reputation: 3581
You can wrap any widget in flutter
with the AbsorbPointer
widget so that you can enable or disable the widget:
body: AbsorbPointer(
absorbing: true,
child: ...
)
The value true
on absorbing
will disable any tap on the child.
Upvotes: 37
Reputation: 92
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.
Upvotes: 1