TapRegion class

A widget that defines a region that can detect taps inside or outside of itself and any group of regions it belongs to, without participating in the gesture disambiguation system (other than to consume tap down events if consumeOutsideTaps is true).

This widget indicates to the nearest ancestor TapRegionSurface that the region occupied by its child will participate in the tap detection for that surface.

If this region belongs to a group (by virtue of its groupId), all the regions in the group will act as one.

If there is no TapRegionSurface ancestor, TapRegion will do nothing.



TapRegion({Key? key, required Widget? child, bool enabled = true, HitTestBehavior behavior = HitTestBehavior.deferToChild, TapRegionCallback? onTapOutside, TapRegionCallback? onTapInside, Object? groupId, bool consumeOutsideTaps = false, String? debugLabel})
Creates a const TapRegion.


behavior HitTestBehavior
How to behave during hit testing when deciding how the hit test propagates to children and whether to consider targets behind this TapRegion.
child Widget?
The widget below this widget in the tree.
consumeOutsideTaps bool
If true, then the group that this region belongs to will stop the propagation of the tap down event in the gesture arena.
debugLabel String?
An optional debug label to help with debugging in debug mode.
enabled bool
Whether or not this TapRegion is enabled as part of the composite region.
groupId Object?
An optional group ID that groups TapRegions together so that they operate as one region. If any member of a group is hit by a particular tap, then the onTapOutside will not be called for any members of the group. If any member of the group is hit, then all members will have their onTapInside called.
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
onTapInside TapRegionCallback?
A callback to be invoked when a tap is detected inside of this TapRegion, or any other tap region with the same groupId, if any.
onTapOutside TapRegionCallback?
A callback to be invoked when a tap is detected outside of this TapRegion and any other region with the same groupId, if any.
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


createElement() SingleChildRenderObjectElement
RenderObjectWidgets always inflate to a RenderObjectElement subclass.
createRenderObject(BuildContext context) RenderObject
Creates an instance of the RenderObject class that this RenderObjectWidget represents, using the configuration described by this RenderObjectWidget.
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
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.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
toStringShort() String
A short, textual description of this widget.
updateRenderObject(BuildContext context, covariant RenderTapRegion 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.


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