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 is aware of the Routes in the Navigator, so that onTapOutside isn't called after the user navigates to a different page.

Inheritance
Implementers

Constructors

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.
const

Properties

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.
final
child Widget?
The widget below this widget in the tree.
finalinherited
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.
final
debugLabel String?
An optional debug label to help with debugging in debug mode.
final
enabled bool
Whether or not this TapRegion is enabled as part of the composite region.
final
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.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
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.
final
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.
final
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.
override
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, int wrapWidth = 65}) 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 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.
override

Operators

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