monodrag.dart 21.8 KB
Newer Older
Ian Hickson's avatar
Ian Hickson committed
1
// Copyright 2014 The Flutter Authors. All rights reserved.
2 3 4
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5
import 'package:flutter/foundation.dart';
6
import 'package:vector_math/vector_math_64.dart';
7

8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
import 'arena.dart';
import 'constants.dart';
import 'drag_details.dart';
import 'events.dart';
import 'recognizer.dart';
import 'velocity_tracker.dart';

enum _DragState {
  ready,
  possible,
  accepted,
}

/// Signature for when a pointer that was previously in contact with the screen
/// and moving is no longer in contact with the screen.
///
/// The velocity at which the pointer was moving when it stopped contacting
/// the screen is available in the `details`.
///
27
/// Used by [DragGestureRecognizer.onEnd].
28
typedef GestureDragEndCallback = void Function(DragEndDetails details);
29 30 31 32

/// Signature for when the pointer that previously triggered a
/// [GestureDragDownCallback] did not complete.
///
33
/// Used by [DragGestureRecognizer.onCancel].
34
typedef GestureDragCancelCallback = void Function();
35

36 37 38
/// Signature for a function that builds a [VelocityTracker].
///
/// Used by [DragGestureRecognizer.velocityTrackerBuilder].
39 40
typedef GestureVelocityTrackerBuilder = VelocityTracker Function(PointerEvent event);

41 42 43 44 45 46 47 48 49 50 51
/// Recognizes movement.
///
/// In contrast to [MultiDragGestureRecognizer], [DragGestureRecognizer]
/// recognizes a single gesture sequence for all the pointers it watches, which
/// means that the recognizer has at most one drag sequence active at any given
/// time regardless of how many pointers are in contact with the screen.
///
/// [DragGestureRecognizer] is not intended to be used directly. Instead,
/// consider using one of its subclasses to recognize specific types for drag
/// gestures.
///
52 53 54 55
/// [DragGestureRecognizer] competes on pointer events of [kPrimaryButton]
/// only when it has at least one non-null callback. If it has no callbacks, it
/// is a no-op.
///
56 57
/// See also:
///
58 59 60
///  * [HorizontalDragGestureRecognizer], for left and right drags.
///  * [VerticalDragGestureRecognizer], for up and down drags.
///  * [PanGestureRecognizer], for drags that are not locked to a single axis.
61
abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
62
  /// Initialize the object.
63 64
  ///
  /// [dragStartBehavior] must not be null.
65
  ///
66
  /// {@macro flutter.gestures.GestureRecognizer.kind}
67
  DragGestureRecognizer({
68 69
    Object? debugOwner,
    PointerDeviceKind? kind,
70
    this.dragStartBehavior = DragStartBehavior.start,
71
    this.velocityTrackerBuilder = _defaultBuilder,
72
  }) : assert(dragStartBehavior != null),
73
       super(debugOwner: debugOwner, kind: kind);
74

75
  static VelocityTracker _defaultBuilder(PointerEvent event) => VelocityTracker.withKind(event.kind);
76 77
  /// Configure the behavior of offsets sent to [onStart].
  ///
78 79 80 81
  /// If set to [DragStartBehavior.start], the [onStart] callback will be called
  /// at the time and position when this gesture recognizer wins the arena. If
  /// [DragStartBehavior.down], [onStart] will be called at the time and
  /// position when a down event was first detected.
82 83
  ///
  /// For more information about the gesture arena:
84
  /// https://flutter.dev/docs/development/ui/advanced/gestures#gesture-disambiguation
85 86 87 88 89
  ///
  /// By default, the drag start behavior is [DragStartBehavior.start].
  ///
  /// ## Example:
  ///
90 91 92
  /// A finger presses down on the screen with offset (500.0, 500.0), and then
  /// moves to position (510.0, 500.0) before winning the arena. With
  /// [dragStartBehavior] set to [DragStartBehavior.down], the [onStart]
93 94 95 96 97
  /// callback will be called at the time corresponding to the touch's position
  /// at (500.0, 500.0). If it is instead set to [DragStartBehavior.start],
  /// [onStart] will be called at the time corresponding to the touch's position
  /// at (510.0, 500.0).
  DragStartBehavior dragStartBehavior;
98

99 100
  /// A pointer has contacted the screen with a primary button and might begin
  /// to move.
101 102 103
  ///
  /// The position of the pointer is provided in the callback's `details`
  /// argument, which is a [DragDownDetails] object.
104 105 106 107 108
  ///
  /// See also:
  ///
  ///  * [kPrimaryButton], the button this callback responds to.
  ///  * [DragDownDetails], which is passed as an argument to this callback.
109
  GestureDragDownCallback? onDown;
110

111 112
  /// A pointer has contacted the screen with a primary button and has begun to
  /// move.
113 114 115
  ///
  /// The position of the pointer is provided in the callback's `details`
  /// argument, which is a [DragStartDetails] object.
116 117 118 119 120
  ///
  /// Depending on the value of [dragStartBehavior], this function will be
  /// called on the initial touch down, if set to [DragStartBehavior.down] or
  /// when the drag gesture is first detected, if set to
  /// [DragStartBehavior.start].
121 122 123 124 125
  ///
  /// See also:
  ///
  ///  * [kPrimaryButton], the button this callback responds to.
  ///  * [DragStartDetails], which is passed as an argument to this callback.
126
  GestureDragStartCallback? onStart;
127

128 129
  /// A pointer that is in contact with the screen with a primary button and
  /// moving has moved again.
130
  ///
131
  /// The distance traveled by the pointer since the last update is provided in
132
  /// the callback's `details` argument, which is a [DragUpdateDetails] object.
133 134 135 136 137
  ///
  /// See also:
  ///
  ///  * [kPrimaryButton], the button this callback responds to.
  ///  * [DragUpdateDetails], which is passed as an argument to this callback.
138
  GestureDragUpdateCallback? onUpdate;
139

140 141 142
  /// A pointer that was previously in contact with the screen with a primary
  /// button and moving is no longer in contact with the screen and was moving
  /// at a specific velocity when it stopped contacting the screen.
143 144 145
  ///
  /// The velocity is provided in the callback's `details` argument, which is a
  /// [DragEndDetails] object.
146 147 148 149 150
  ///
  /// See also:
  ///
  ///  * [kPrimaryButton], the button this callback responds to.
  ///  * [DragEndDetails], which is passed as an argument to this callback.
151
  GestureDragEndCallback? onEnd;
152 153

  /// The pointer that previously triggered [onDown] did not complete.
154 155 156 157
  ///
  /// See also:
  ///
  ///  * [kPrimaryButton], the button this callback responds to.
158
  GestureDragCancelCallback? onCancel;
159 160 161 162 163 164

  /// The minimum distance an input pointer drag must have moved to
  /// to be considered a fling gesture.
  ///
  /// This value is typically compared with the distance traveled along the
  /// scrolling axis. If null then [kTouchSlop] is used.
165
  double? minFlingDistance;
166 167 168 169 170 171

  /// The minimum velocity for an input pointer drag to be considered fling.
  ///
  /// This value is typically compared with the magnitude of fling gesture's
  /// velocity along the scrolling axis. If null then [kMinFlingVelocity]
  /// is used.
172
  double? minFlingVelocity;
173 174 175 176

  /// Fling velocity magnitudes will be clamped to this value.
  ///
  /// If null then [kMaxFlingVelocity] is used.
177
  double? maxFlingVelocity;
178

179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
  /// Determines the type of velocity estimation method to use for a potential
  /// drag gesture, when a new pointer is added.
  ///
  /// To estimate the velocity of a gesture, [DragGestureRecognizer] calls
  /// [velocityTrackerBuilder] when it starts to track a new pointer in
  /// [addAllowedPointer], and add subsequent updates on the pointer to the
  /// resulting velocity tracker, until the gesture recognizer stops tracking
  /// the pointer. This allows you to specify a different velocity estimation
  /// strategy for each allowed pointer added, by changing the type of velocity
  /// tracker this [GestureVelocityTrackerBuilder] returns.
  ///
  /// If left unspecified the default [velocityTrackerBuilder] creates a new
  /// [VelocityTracker] for every pointer added.
  ///
  /// See also:
  ///
  ///  * [VelocityTracker], a velocity tracker that uses least squares estimation
  ///    on the 20 most recent pointer data samples. It's a well-rounded velocity
  ///    tracker and is used by default.
  ///  * [IOSScrollViewFlingVelocityTracker], a specialized velocity tracker for
  ///    determining the initial fling velocity for a [Scrollable] on iOS, to
  ///    match the native behavior on that platform.
  GestureVelocityTrackerBuilder velocityTrackerBuilder;

203
  _DragState _state = _DragState.ready;
204 205 206
  late OffsetPair _initialPosition;
  late OffsetPair _pendingDragOffset;
  Duration? _lastPendingEventTimestamp;
207 208
  // The buttons sent by `PointerDownEvent`. If a `PointerMoveEvent` comes with a
  // different set of buttons, the gesture is canceled.
209 210
  int? _initialButtons;
  Matrix4? _lastTransform;
211 212 213 214 215

  /// Distance moved in the global coordinate space of the screen in drag direction.
  ///
  /// If drag is only allowed along a defined axis, this value may be negative to
  /// differentiate the direction of the drag.
216
  late double _globalDistanceMoved;
217

218 219 220 221 222
  /// Determines if a gesture is a fling or not based on velocity.
  ///
  /// A fling calls its gesture end callback with a velocity, allowing the
  /// provider of the callback to respond by carrying the gesture forward with
  /// inertia, for example.
223
  bool isFlingGesture(VelocityEstimate estimate, PointerDeviceKind kind);
224

225
  Offset _getDeltaForDetails(Offset delta);
226
  double? _getPrimaryValueFromOffset(Offset value);
227
  bool _hasSufficientGlobalDistanceToAccept(PointerDeviceKind pointerDeviceKind);
228 229 230

  final Map<int, VelocityTracker> _velocityTrackers = <int, VelocityTracker>{};

231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
  @override
  bool isPointerAllowed(PointerEvent event) {
    if (_initialButtons == null) {
      switch (event.buttons) {
        case kPrimaryButton:
          if (onDown == null &&
              onStart == null &&
              onUpdate == null &&
              onEnd == null &&
              onCancel == null)
            return false;
          break;
        default:
          return false;
      }
    } else {
      // There can be multiple drags simultaneously. Their effects are combined.
      if (event.buttons != _initialButtons) {
        return false;
      }
    }
252
    return super.isPointerAllowed(event as PointerDownEvent);
253 254
  }

255
  @override
256
  void addAllowedPointer(PointerEvent event) {
257
    startTrackingPointer(event.pointer, event.transform);
258
    _velocityTrackers[event.pointer] = velocityTrackerBuilder(event);
259 260
    if (_state == _DragState.ready) {
      _state = _DragState.possible;
261
      _initialPosition = OffsetPair(global: event.position, local: event.localPosition);
262
      _initialButtons = event.buttons;
263 264
      _pendingDragOffset = OffsetPair.zero;
      _globalDistanceMoved = 0.0;
265
      _lastPendingEventTimestamp = event.timeStamp;
266
      _lastTransform = event.transform;
267
      _checkDown();
268 269
    } else if (_state == _DragState.accepted) {
      resolve(GestureDisposition.accepted);
270 271 272 273 274 275
    }
  }

  @override
  void handleEvent(PointerEvent event) {
    assert(_state != _DragState.ready);
276 277
    if (!event.synthesized
        && (event is PointerDownEvent || event is PointerMoveEvent)) {
278
      final VelocityTracker tracker = _velocityTrackers[event.pointer]!;
279
      assert(tracker != null);
280
      tracker.addPosition(event.timeStamp, event.localPosition);
281 282 283
    }

    if (event is PointerMoveEvent) {
284
      if (event.buttons != _initialButtons) {
285
        _giveUpPointer(event.pointer);
286 287
        return;
      }
288
      if (_state == _DragState.accepted) {
289 290
        _checkUpdate(
          sourceTimeStamp: event.timeStamp,
291 292
          delta: _getDeltaForDetails(event.localDelta),
          primaryDelta: _getPrimaryValueFromOffset(event.localDelta),
293
          globalPosition: event.position,
294
          localPosition: event.localPosition,
295
        );
296
      } else {
297
        _pendingDragOffset += OffsetPair(local: event.localDelta, global: event.delta);
298
        _lastPendingEventTimestamp = event.timeStamp;
299 300
        _lastTransform = event.transform;
        final Offset movedLocally = _getDeltaForDetails(event.localDelta);
301
        final Matrix4? localToGlobalTransform = event.transform == null ? null : Matrix4.tryInvert(event.transform!);
302 303 304 305 306
        _globalDistanceMoved += PointerEvent.transformDeltaViaPositions(
          transform: localToGlobalTransform,
          untransformedDelta: movedLocally,
          untransformedEndPosition: event.localPosition,
        ).distance * (_getPrimaryValueFromOffset(movedLocally) ?? 1).sign;
307
        if (_hasSufficientGlobalDistanceToAccept(event.kind))
308 309 310
          resolve(GestureDisposition.accepted);
      }
    }
311 312 313 314 315 316
    if (event is PointerUpEvent || event is PointerCancelEvent) {
      _giveUpPointer(
        event.pointer,
        reject: event is PointerCancelEvent || _state ==_DragState.possible,
      );
    }
317 318 319 320 321 322
  }

  @override
  void acceptGesture(int pointer) {
    if (_state != _DragState.accepted) {
      _state = _DragState.accepted;
323
      final OffsetPair delta = _pendingDragOffset;
324 325
      final Duration timestamp = _lastPendingEventTimestamp!;
      final Matrix4? transform = _lastTransform;
326
      final Offset localUpdateDelta;
327 328 329
      switch (dragStartBehavior) {
        case DragStartBehavior.start:
          _initialPosition = _initialPosition + delta;
330
          localUpdateDelta = Offset.zero;
331 332
          break;
        case DragStartBehavior.down:
333
          localUpdateDelta = _getDeltaForDetails(delta.local);
334 335
          break;
      }
336
      _pendingDragOffset = OffsetPair.zero;
337
      _lastPendingEventTimestamp = null;
338
      _lastTransform = null;
339
      _checkStart(timestamp, pointer);
340
      if (localUpdateDelta != Offset.zero && onUpdate != null) {
341
        final Matrix4? localToGlobal = transform != null ? Matrix4.tryInvert(transform) : null;
342 343 344 345 346 347 348 349
        final Offset correctedLocalPosition = _initialPosition.local + localUpdateDelta;
        final Offset globalUpdateDelta = PointerEvent.transformDeltaViaPositions(
          untransformedEndPosition: correctedLocalPosition,
          untransformedDelta: localUpdateDelta,
          transform: localToGlobal,
        );
        final OffsetPair updateDelta = OffsetPair(local: localUpdateDelta, global: globalUpdateDelta);
        final OffsetPair correctedPosition = _initialPosition + updateDelta; // Only adds delta for down behaviour
350
        _checkUpdate(
351
          sourceTimeStamp: timestamp,
352 353 354 355
          delta: localUpdateDelta,
          primaryDelta: _getPrimaryValueFromOffset(localUpdateDelta),
          globalPosition: correctedPosition.global,
          localPosition: correctedPosition.local,
356
        );
357 358 359 360 361 362
      }
    }
  }

  @override
  void rejectGesture(int pointer) {
363
    _giveUpPointer(pointer);
364 365 366 367
  }

  @override
  void didStopTrackingLastPointer(int pointer) {
368 369 370 371 372 373 374 375 376 377 378 379 380
    assert(_state != _DragState.ready);
    switch(_state) {
      case _DragState.ready:
        break;

      case _DragState.possible:
        resolve(GestureDisposition.rejected);
        _checkCancel();
        break;

      case _DragState.accepted:
        _checkEnd(pointer);
        break;
381
    }
382 383
    _velocityTrackers.clear();
    _initialButtons = null;
384
    _state = _DragState.ready;
385
  }
386

387 388
  void _giveUpPointer(int pointer, {bool reject = true}) {
    stopTrackingPointer(pointer);
389 390
    if (reject)
      resolvePointer(pointer, GestureDisposition.rejected);
391 392
  }

393 394 395
  void _checkDown() {
    assert(_initialButtons == kPrimaryButton);
    final DragDownDetails details = DragDownDetails(
396 397
      globalPosition: _initialPosition.global,
      localPosition: _initialPosition.local,
398 399
    );
    if (onDown != null)
400
      invokeCallback<void>('onDown', () => onDown!(details));
401 402
  }

403
  void _checkStart(Duration timestamp, int pointer) {
404 405 406
    assert(_initialButtons == kPrimaryButton);
    final DragStartDetails details = DragStartDetails(
      sourceTimeStamp: timestamp,
407 408
      globalPosition: _initialPosition.global,
      localPosition: _initialPosition.local,
409
      kind: getKindForPointer(pointer),
410 411
    );
    if (onStart != null)
412
      invokeCallback<void>('onStart', () => onStart!(details));
413 414 415
  }

  void _checkUpdate({
416 417 418 419 420
    Duration? sourceTimeStamp,
    required Offset delta,
    double? primaryDelta,
    required Offset globalPosition,
    Offset? localPosition,
421 422 423 424 425 426 427
  }) {
    assert(_initialButtons == kPrimaryButton);
    final DragUpdateDetails details = DragUpdateDetails(
      sourceTimeStamp: sourceTimeStamp,
      delta: delta,
      primaryDelta: primaryDelta,
      globalPosition: globalPosition,
428
      localPosition: localPosition,
429 430
    );
    if (onUpdate != null)
431
      invokeCallback<void>('onUpdate', () => onUpdate!(details));
432 433 434 435 436 437 438
  }

  void _checkEnd(int pointer) {
    assert(_initialButtons == kPrimaryButton);
    if (onEnd == null)
      return;

439
    final VelocityTracker tracker = _velocityTrackers[pointer]!;
440 441
    assert(tracker != null);

442 443
    final DragEndDetails details;
    final String Function() debugReport;
444

445
    final VelocityEstimate? estimate = tracker.getVelocityEstimate();
446
    if (estimate != null && isFlingGesture(estimate, tracker.kind)) {
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465
      final Velocity velocity = Velocity(pixelsPerSecond: estimate.pixelsPerSecond)
        .clampMagnitude(minFlingVelocity ?? kMinFlingVelocity, maxFlingVelocity ?? kMaxFlingVelocity);
      details = DragEndDetails(
        velocity: velocity,
        primaryVelocity: _getPrimaryValueFromOffset(velocity.pixelsPerSecond),
      );
      debugReport = () {
        return '$estimate; fling at $velocity.';
      };
    } else {
      details = DragEndDetails(
        velocity: Velocity.zero,
        primaryVelocity: 0.0,
      );
      debugReport = () {
        if (estimate == null)
          return 'Could not estimate velocity.';
        return '$estimate; judged to not be a fling.';
      };
466
    }
467
    invokeCallback<void>('onEnd', () => onEnd!(details), debugReport: debugReport);
468 469 470 471 472
  }

  void _checkCancel() {
    assert(_initialButtons == kPrimaryButton);
    if (onCancel != null)
473
      invokeCallback<void>('onCancel', onCancel!);
474 475 476 477 478 479 480
  }

  @override
  void dispose() {
    _velocityTrackers.clear();
    super.dispose();
  }
481 482 483
  @override
  void debugFillProperties(DiagnosticPropertiesBuilder properties) {
    super.debugFillProperties(properties);
484
    properties.add(EnumProperty<DragStartBehavior>('start behavior', dragStartBehavior));
485
  }
486 487 488 489 490 491 492 493
}

/// Recognizes movement in the vertical direction.
///
/// Used for vertical scrolling.
///
/// See also:
///
494 495 496 497
///  * [HorizontalDragGestureRecognizer], for a similar recognizer but for
///    horizontal movement.
///  * [MultiDragGestureRecognizer], for a family of gesture recognizers that
///    track each touch point independently.
498
class VerticalDragGestureRecognizer extends DragGestureRecognizer {
499
  /// Create a gesture recognizer for interactions in the vertical axis.
500
  ///
501
  /// {@macro flutter.gestures.GestureRecognizer.kind}
502
  VerticalDragGestureRecognizer({
503 504
    Object? debugOwner,
    PointerDeviceKind? kind,
505
  }) : super(debugOwner: debugOwner, kind: kind);
506

507
  @override
508
  bool isFlingGesture(VelocityEstimate estimate, PointerDeviceKind kind) {
509
    final double minVelocity = minFlingVelocity ?? kMinFlingVelocity;
510
    final double minDistance = minFlingDistance ?? computeHitSlop(kind);
511 512 513 514
    return estimate.pixelsPerSecond.dy.abs() > minVelocity && estimate.offset.dy.abs() > minDistance;
  }

  @override
515 516 517
  bool _hasSufficientGlobalDistanceToAccept(PointerDeviceKind pointerDeviceKind) {
    return _globalDistanceMoved.abs() > computeHitSlop(pointerDeviceKind);
  }
518 519

  @override
520
  Offset _getDeltaForDetails(Offset delta) => Offset(0.0, delta.dy);
521 522 523 524 525

  @override
  double _getPrimaryValueFromOffset(Offset value) => value.dy;

  @override
526
  String get debugDescription => 'vertical drag';
527 528 529 530 531 532 533 534
}

/// Recognizes movement in the horizontal direction.
///
/// Used for horizontal scrolling.
///
/// See also:
///
535 536 537 538
///  * [VerticalDragGestureRecognizer], for a similar recognizer but for
///    vertical movement.
///  * [MultiDragGestureRecognizer], for a family of gesture recognizers that
///    track each touch point independently.
539
class HorizontalDragGestureRecognizer extends DragGestureRecognizer {
540
  /// Create a gesture recognizer for interactions in the horizontal axis.
541
  ///
542
  /// {@macro flutter.gestures.GestureRecognizer.kind}
543
  HorizontalDragGestureRecognizer({
544 545
    Object? debugOwner,
    PointerDeviceKind? kind,
546
  }) : super(debugOwner: debugOwner, kind: kind);
547

548
  @override
549
  bool isFlingGesture(VelocityEstimate estimate, PointerDeviceKind kind) {
550
    final double minVelocity = minFlingVelocity ?? kMinFlingVelocity;
551
    final double minDistance = minFlingDistance ?? computeHitSlop(kind);
552 553 554 555
    return estimate.pixelsPerSecond.dx.abs() > minVelocity && estimate.offset.dx.abs() > minDistance;
  }

  @override
556 557 558
  bool _hasSufficientGlobalDistanceToAccept(PointerDeviceKind pointerDeviceKind) {
    return _globalDistanceMoved.abs() > computeHitSlop(pointerDeviceKind);
  }
559 560

  @override
561
  Offset _getDeltaForDetails(Offset delta) => Offset(delta.dx, 0.0);
562 563 564 565 566

  @override
  double _getPrimaryValueFromOffset(Offset value) => value.dx;

  @override
567
  String get debugDescription => 'horizontal drag';
568 569 570 571 572 573
}

/// Recognizes movement both horizontally and vertically.
///
/// See also:
///
574 575 576 577 578
///  * [ImmediateMultiDragGestureRecognizer], for a similar recognizer that
///    tracks each touch point independently.
///  * [DelayedMultiDragGestureRecognizer], for a similar recognizer that
///    tracks each touch point independently, but that doesn't start until
///    some time has passed.
579
class PanGestureRecognizer extends DragGestureRecognizer {
580
  /// Create a gesture recognizer for tracking movement on a plane.
581
  PanGestureRecognizer({ Object? debugOwner }) : super(debugOwner: debugOwner);
582

583
  @override
584
  bool isFlingGesture(VelocityEstimate estimate, PointerDeviceKind kind) {
585
    final double minVelocity = minFlingVelocity ?? kMinFlingVelocity;
586
    final double minDistance = minFlingDistance ?? computeHitSlop(kind);
587 588
    return estimate.pixelsPerSecond.distanceSquared > minVelocity * minVelocity
        && estimate.offset.distanceSquared > minDistance * minDistance;
589 590 591
  }

  @override
592 593
  bool _hasSufficientGlobalDistanceToAccept(PointerDeviceKind pointerDeviceKind) {
    return _globalDistanceMoved.abs() > computePanSlop(pointerDeviceKind);
594 595 596 597 598 599
  }

  @override
  Offset _getDeltaForDetails(Offset delta) => delta;

  @override
600
  double? _getPrimaryValueFromOffset(Offset value) => null;
601 602

  @override
603
  String get debugDescription => 'pan';
604
}