PointerEvent class

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:

Implemented by
Annotations
  • @immutable

Constructors

PointerEvent({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 radiusMajor: 0.0, double radiusMinor: 0.0, double radiusMin: 0.0, double radiusMax: 0.0, double orientation: 0.0, double tilt: 0.0, bool synthesized: false })
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 (primaryMouseButton, secondaryStylusButton, etc). For example, if this has the value 6 and the kind is PointerDeviceKind.invertedStylus, then this indicates an upside-down stylus with both its primary and secondary buttons pressed.
final
delta Offset
Distance in logical pixels that the pointer moved since the last PointerMoveEvent. Always 0.0 for down, up, and cancel events.
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 (e.g. the distance of a stylus or finger from a touch screen), in arbitrary units on an arbitrary (not necessarily linear) scale. If the pointer is down, this is 0.0 by definition.
final
distanceMax double
The maximum value that a distance can return for this pointer. If this input device cannot detect "hover touch" input events, then this will be 0.0.
final
distanceMin double
The minimum value that a distance can return for this pointer (always 0.0).
final
down bool
Set if the pointer is currently down. For touch and stylus pointers, this means the object (finger, pen) is in contact with the input surface. For mice, it means a button is pressed.
final
kind PointerDeviceKind
The kind of input device for which the event was generated.
final
obscured bool
Set if an application from a different security domain is in any way obscuring this application's window. (Aspirational; not currently implemented.)
final
orientation double
For PointerDeviceKind.touch events: [...]
final
pointer int
Unique identifier for the pointer, not reused.
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 as a number ranging from 0.0, indicating a touch with no discernible pressure, to 1.0, indicating a touch with "normal" pressure, and possibly beyond, indicating a stronger touch. For devices that do not detect pressure (e.g. mice), returns 1.0.
final
pressureMax double
The maximum value that pressure can return for this pointer. For devices that do not detect pressure (e.g. mice), returns 1.0. This will always be a greater than or equal to 1.0.
final
pressureMin double
The minimum value that pressure can return for this pointer. For devices that do not detect pressure (e.g. mice), returns 1.0. This will always be a number less than or equal to 1.0.
final
radiusMajor double
The radius of the contact ellipse along the major axis, in logical pixels.
final
radiusMax double
The minimum 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
synthesized bool
We occasionally synthesize PointerEvents that aren't exact translations of ui.PointerData from the engine to cover small cross-OS discrepancies in pointer behaviors. [...]
final
tilt double
For PointerDeviceKind.stylus and PointerDeviceKind.invertedStylus events: [...]
final
timeStamp Duration
Time of event dispatch, relative to an arbitrary timeline.
final
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

toString() String
Returns a string representation of this object.
toStringFull() String
Returns a complete textual description of this event.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited