affinity property Null safety

Axis? affinity

Controls how this widget competes with other gestures to initiate a drag.

If affinity is null, this widget initiates a drag as soon as it recognizes a tap down gesture, regardless of any directionality. If affinity is horizontal (or vertical), then this widget will compete with other horizontal (or vertical, respectively) gestures.

For example, if this widget is placed in a vertically scrolling region and has horizontal affinity, pointer motion in the vertical direction will result in a scroll and pointer motion in the horizontal direction will result in a drag. Conversely, if the widget has a null or vertical affinity, pointer motion in any direction will result in a drag rather than in a scroll because the draggable widget, being the more specific widget, will out-compete the Scrollable for vertical gestures.

For the directions this widget can be dragged in after the drag event starts, see Draggable.axis.


final Axis? affinity;