Flutter disable touch on the entire screen

user6274128 picture user6274128 · Jan 16, 2019 · Viewed 8k times · Source

Is there any way to prevent my screen from receiving touch events, I don't want to disable touch for every Widget in my app. I just want to lock the app so that it doesn't receive touch events. How can I do that?

Answer

user6274128 picture user6274128 · Jan 16, 2019

You can wrap your widget in AbsorbPointer and it won't receive touches. To enable the touch again, you can set absorbing: false

AbsorbPointer(
  child: YourWidget(...),
);