menu

  1. [ Flutter ](index.html)
  2. [ widgets.dart ](widgets/widgets-library.html)
  3. AbsorbPointer class 

AbsorbPointer

brightness_4  brightness_5

[ description
](https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/widgets/basic.dart#L6949
"View source code")

#  AbsorbPointer  class

A widget that absorbs pointers during hit testing.

When [ absorbing ](widgets/AbsorbPointer/absorbing.html) is true, this widget
prevents its subtree from receiving pointer events by terminating hit testing
at itself. It still consumes space during layout and paints its child as
usual. It just prevents its children from being the target of located events,
because it returns true from [ RenderBox.hitTest
](rendering/RenderBox/hitTest.html) .

When [ ignoringSemantics ](widgets/AbsorbPointer/ignoringSemantics.html) is
true, the subtree will be invisible to the semantics layer (and thus e.g.
accessibility tools).

The following sample has an [ AbsorbPointer ](widgets/AbsorbPointer-
class.html) widget wrapping the button on top of the stack, which absorbs
pointer events, preventing its child button **and** the button below it in the
stack from receiving the pointer events.

_link_

To create a local project with this code sample, run:  
flutter create --sample=widgets.AbsorbPointer.1 mysample

##  Semantics

Using this class may also affect how the semantics subtree underneath is
collected.

If [ absorbing ](widgets/AbsorbPointer/absorbing.html) is true, pointer-
related [ SemanticsAction ](dart-ui/SemanticsAction-class.html) s are removed
from the semantics subtree. Otherwise, the subtree remains untouched.

The usages of [ ignoringSemantics
](widgets/AbsorbPointer/ignoringSemantics.html) are deprecated and not
recommended. This property was introduced to workaround the semantics behavior
of the [ IgnorePointer ](widgets/IgnorePointer-class.html) and its friends
before v3.8.0-12.0.pre.

Before that version, entire semantics subtree is dropped if [ absorbing
](widgets/AbsorbPointer/absorbing.html) is true. Developers can only use [
ignoringSemantics ](widgets/AbsorbPointer/ignoringSemantics.html) to preserver
the semantics subtrees.

After that version, with [ absorbing ](widgets/AbsorbPointer/absorbing.html)
set to true, it only prevents semantics user actions in the semantics subtree
but leaves the other [ SemanticsProperties ](semantics/SemanticsProperties-
class.html) intact. Therefore, the [ ignoringSemantics
](widgets/AbsorbPointer/ignoringSemantics.html) is no longer needed.

If [ ignoringSemantics ](widgets/AbsorbPointer/ignoringSemantics.html) is
true, the semantics subtree is dropped. Therefore, the subtree will be
invisible to assistive technologies.

If [ ignoringSemantics ](widgets/AbsorbPointer/ignoringSemantics.html) is
false, the semantics subtree is collected as usual.

See also:

  * [ IgnorePointer ](widgets/IgnorePointer-class.html) , which also prevents its children from receiving pointer events but is itself invisible to hit testing. 

Inheritance

    

  * [ Object ](dart-core/Object-class.html)
  * [ DiagnosticableTree ](foundation/DiagnosticableTree-class.html)
  * [ Widget ](widgets/Widget-class.html)
  * [ RenderObjectWidget ](widgets/RenderObjectWidget-class.html)
  * [ SingleChildRenderObjectWidget ](widgets/SingleChildRenderObjectWidget-class.html)
  * AbsorbPointer 

##  Constructors

[ AbsorbPointer ](widgets/AbsorbPointer/AbsorbPointer.html) (  {  [ Key
](foundation/Key-class.html) ?  key  ,  [ bool ](dart-core/bool-class.html)
absorbing  =  true  ,  @ [ Deprecated ](dart-core/Deprecated-class.html) ('Use
ExcludeSemantics or create a custom absorb pointer widget instead. ' 'This
feature was deprecated after v3.8.0-12.0.pre.')  [ bool ](dart-core/bool-
class.html) ?  ignoringSemantics  ,  [ Widget ](widgets/Widget-class.html) ?
child  }  )

     Creates a widget that absorbs pointers during hit testing. 

const

##  Properties

[ absorbing ](widgets/AbsorbPointer/absorbing.html) → [ bool