TapRegionSurface class

A widget that provides notification of a tap inside or outside of a set of registered regions, without participating in the gesture disambiguation system.

The regions are defined by adding TapRegion widgets to the widget tree around the regions of interest, and they will register with this TapRegionSurface. Each of the tap regions can optionally belong to a group by assigning a TapRegion.groupId, where all the regions with the same groupId act as if they were all one region.

When a tap outside of a registered region or region group is detected, its TapRegion.onTapOutside callback is called. If the tap is outside one member of a group, but inside another, no notification is made.

When a tap inside of a registered region or region group is detected, its TapRegion.onTapInside callback is called. If the tap is inside one member of a group, all members are notified.

The TapRegionSurface should be defined at the highest level needed to encompass the entire area where taps should be monitored. This is typically around the entire app. If the entire app isn't covered, then taps outside of the TapRegionSurface will be ignored and no TapRegion.onTapOutside calls will be made for those events. The WidgetsApp, MaterialApp and CupertinoApp automatically include a TapRegionSurface around their entire app.

TapRegionSurface does not participate in the gesture disambiguation system, so if multiple TapRegionSurfaces are active at the same time, they will all fire, and so will any other gestures recognized by a GestureDetector or other pointer event handlers.

TapRegions register only with the nearest ancestor TapRegionSurface.

See also:

Inheritance

Constructors

TapRegionSurface({Key? key, required Widget child})
Creates a const RenderTapRegionSurface.
const

Properties

child Widget?
The widget below this widget in the tree.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() SingleChildRenderObjectElement
RenderObjectWidgets always inflate to a RenderObjectElement subclass.
inherited
createRenderObject(BuildContext context) RenderObject
Creates an instance of the RenderObject class that this RenderObjectWidget represents, using the configuration described by this RenderObjectWidget.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
didUnmountRenderObject(covariant RenderObject renderObject) → void
A render object previously associated with this widget has been removed from the tree. The given RenderObject will be of the same type as returned by this object's createRenderObject.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited
updateRenderObject(BuildContext context, covariant RenderProxyBoxWithHitTestBehavior renderObject) → void
Copies the configuration described by this RenderObjectWidget to the given RenderObject, which will be of the same type as returned by this object's createRenderObject.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited