How to ignore touch events of any widgets in flutter | Flutter AbsorbPointer

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video I will show you how to disable multiple widgets from any T action by using just a single widget so in my simulator there are two buttons which currently have an ontap function whenever I tap on the buttons it will print out a sample string to the console so for example if you wanted to add conditions to the button so that it Ena to be tapped only when certain conditions are met you might add an if statement to check the condition however if the conditions applied to other wigets in the same screen which in this example is the button below you will have to replicate the same if statement in each on TCT function this will create more boiler plates to your code base as the widget Tree Grows to solve this I would like to introduce you to a vet called absorb pointer abor pointer viget will prevent its entire subtree from being tapped in this example I will wrap the column viget that contains both buttons with absorb pointer viget and set the absorbing parameter to true this absorb pointer viget will apply to the entire sub tree viget which is the whole column viget now when I click on the button nothing printed out in the console for both buttons so with this absorbing pointer viget with some sort of having a centralized control that Target a sub three viget rather than just a single viget but in a condition that the sub wigets apply the same condition which now you just have to set your condition in the absorbing parameter once so this is how you disable tap events for entire subtree wiget in flutter using absorb pointer wiget if you have any question feel free to comment below don't forget to like the video and subscribe to our Channel see you in the next video
Info
Channel: AI with Flutter
Views: 451
Rating: undefined out of 5
Keywords: flutter widget of the week, flutter absorbpointer, flutter widget, flutter tutorial for beginner, flutter touch events, flutter gesture detector, flutter inkwell
Id: SQr0kU_C5g4
Channel Id: undefined
Length: 2min 13sec (133 seconds)
Published: Fri Feb 23 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.