How Disable all Widget
Use AbsorbPointer Widget
Today, I will introduce to a new widget in Flutter with which you can enable or disable any widget in Flutter.
If you wrap any widget in Flutter with the AbsorbPointer Widget, you can enable or disable that widget. That means if you wrap your whole UI in AbsorbPointer Widget, then you can control the user interaction on that UI by toggling the ‘absorbing’ property of AbsorbPointer Widget. When ‘absorbing‘ is true, the AbsorbPointer Widget absorbs all interaction in the widget’s child and in a way disabling it.
Let’s jump into the code.
The below code has three buttons, up on enabling the ‘absorbing‘ to false, all the buttons will be disabled at the same time and vice-versa.
Watch Video Tutorial
Below is the sample code
Take a look at this line above
false = button aktif
true = button nonaktif
https://www.coderzheaven.com/2019/01/20/flutter-tutorial-enable-disable-any-widget-android-and-ios/
Last updated