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

import 'recognizer.dart';

7 8 9 10
export 'dart:ui' show PointerDeviceKind;

export 'events.dart' show PointerDownEvent, PointerEvent;

11 12 13 14 15 16
/// A gesture recognizer that eagerly claims victory in all gesture arenas.
///
/// This is typically passed in [AndroidView.gestureRecognizers] in order to immediately dispatch
/// all touch events inside the view bounds to the embedded Android view.
/// See [AndroidView.gestureRecognizers] for more details.
class EagerGestureRecognizer extends OneSequenceGestureRecognizer {
17 18
  /// Create an eager gesture recognizer.
  ///
19 20
  /// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
  EagerGestureRecognizer({
21
    super.supportedDevices,
22
    super.allowedButtonsFilter,
23
  });
24

25
  @override
26
  void addAllowedPointer(PointerDownEvent event) {
27
    super.addAllowedPointer(event);
28 29 30 31 32 33 34 35
    resolve(GestureDisposition.accepted);
    stopTrackingPointer(event.pointer);
  }

  @override
  String get debugDescription => 'eager';

  @override
36
  void didStopTrackingLastPointer(int pointer) { }
37 38

  @override
39
  void handleEvent(PointerEvent event) { }
40
}