PointerEvent class abstract

Base class for touch, stylus, or mouse events.

Pointer events operate in the coordinate space of the screen, scaled to logical pixels. Logical pixels approximate a grid with about 38 pixels per centimeter, or 96 pixels per inch.

This allows gestures to be recognized independent of the precise hardware characteristics of the device. In particular, features such as touch slop (see kTouchSlop) can be defined in terms of roughly physical lengths so that the user can shift their finger by the same distance on a high-density display as on a low-resolution device.

For similar reasons, pointer events are not affected by any transforms in the rendering layer. This means that deltas may need to be scaled before being applied to movement within the rendering. For example, if a scrolling list is shown scaled by 2x, the pointer deltas will have to be scaled by the inverse amount if the list is to appear to scroll with the user's finger.

See also:

Mixed in types
Implementers
Annotations

Constructors

PointerEvent({int viewId = 0, int embedderId = 0, Duration timeStamp = Duration.zero, int pointer = 0, PointerDeviceKind kind = PointerDeviceKind.touch, int device = 0, Offset position = Offset.zero, Offset delta = Offset.zero, int buttons = 0, bool down = false, bool obscured = false, double pressure = 1.0, double pressureMin = 1.0, double pressureMax = 1.0, double distance = 0.0, double distanceMax = 0.0, double size = 0.0, double radiusMajor = 0.0, double radiusMinor = 0.0, double radiusMin = 0.0, double radiusMax = 0.0, double orientation = 0.0, double tilt = 0.0, int platformData = 0, bool synthesized = false, Matrix4? transform, PointerEvent? original})
Abstract const constructor. This constructor enables subclasses to provide const constructors so that they can be used in const expressions.
const

Properties

buttons int
Bit field using the *Button constants such as kPrimaryMouseButton, kSecondaryStylusButton, etc.
final
delta Offset
Distance in logical pixels that the pointer moved since the last PointerMoveEvent or PointerHoverEvent.
final
device int
Unique identifier for the pointing device, reused across interactions.
final
distance double
The distance of the detected object from the input surface.
final
distanceMax double
The maximum value that distance can return for this pointer.
final
distanceMin double
The minimum value that distance can return for this pointer.
no setter
down bool
Set if the pointer is currently down.
final
embedderId int
Unique identifier that ties the PointerEvent to the embedder event that created it.
final
hashCode int
The hash code for this object.
no setterinherited
kind PointerDeviceKind
The kind of input device for which the event was generated.
final
localDelta Offset
The delta transformed into the event receiver's local coordinate system according to transform.
no setter
localPosition Offset
The position transformed into the event receiver's local coordinate system according to transform.
no setter
obscured bool
Set if an application from a different security domain is in any way obscuring this application's window.
final
orientation double
The orientation angle of the detected object, in radians.
final
original PointerEvent?
The original un-transformed PointerEvent before any transforms were applied.
final
platformData int
Opaque platform-specific data associated with the event.
final
pointer int
Unique identifier for the pointer, not reused. Changes for each new pointer down event.
final
position Offset
Coordinate of the position of the pointer, in logical pixels in the global coordinate space.
final
pressure double
The pressure of the touch.
final
pressureMax double
The maximum value that pressure can return for this pointer.
final
pressureMin double
The minimum value that pressure can return for this pointer.
final
radiusMajor double
The radius of the contact ellipse along the major axis, in logical pixels.
final
radiusMax double
The maximum value that could be reported for radiusMajor and radiusMinor for this pointer, in logical pixels.
final
radiusMin double
The minimum value that could be reported for radiusMajor and radiusMinor for this pointer, in logical pixels.
final
radiusMinor double
The radius of the contact ellipse along the minor axis, in logical pixels.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size double
The area of the screen being pressed.
final
synthesized bool
Set if the event was synthesized by Flutter.
final
tilt double
The tilt angle of the detected object, in radians.
final
timeStamp Duration
Time of event dispatch, relative to an arbitrary timeline.
final
transform Matrix4?
The transformation used to transform this event from the global coordinate space into the coordinate space of the event receiver.
final
viewId int
The ID of the FlutterView which this event originated from.
final

Methods

copyWith({int? viewId, Duration? timeStamp, int? pointer, PointerDeviceKind? kind, int? device, Offset? position, Offset? delta, int? buttons, bool? obscured, double? pressure, double? pressureMin, double? pressureMax, double? distance, double? distanceMax, double? size, double? radiusMajor, double? radiusMinor, double? radiusMin, double? radiusMax, double? orientation, double? tilt, bool? synthesized, int? embedderId}) PointerEvent
Creates a copy of event with the specified properties replaced.
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
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
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited
transformed(Matrix4? transform) PointerEvent
Transforms the event from the global coordinate space into the coordinate space of an event receiver.

Operators

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

Static Methods

removePerspectiveTransform(Matrix4 transform) Matrix4
Removes the "perspective" component from transform.
transformDeltaViaPositions({required Offset untransformedEndPosition, Offset? transformedEndPosition, required Offset untransformedDelta, required Matrix4? transform}) Offset
Transforms untransformedDelta into the coordinate system described by transform.
transformPosition(Matrix4? transform, Offset position) Offset
Returns the transformation of position into the coordinate system described by transform.