• Chris Bracken's avatar
    Revert elimination of Dart 1 (#18460) · 2ae48845
    Chris Bracken authored
    fuchsia_tester.dart still assumes Dart 1. Previously, it ran tests directly
    from source, flutter_platform.dart automatically runs a kernel compile when
    operating in Dart 2 mode, but this assumes a functional Dart SDK is available
    in the artifacts directly, and fuchsia_tester.dart mocks out the artifacts
    directory with an empty temp dir.
    
    Remaining work is:
    1. Get the frontend server building as a dependency on Fuchsia.
    2. Patch fuchsia_tester.dart to use a valid Dart SDK and frontend server.
    
    This also reverts migration to Dart 2 typedef syntax.
    
    This reverts commit 6c56bb24. (#18362)
    This reverts commit 3daebd05. (#18316)
    Unverified
    2ae48845
long_press.dart 1.28 KB
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'arena.dart';
import 'constants.dart';
import 'events.dart';
import 'recognizer.dart';

/// Signature for when a pointer has remained in contact with the screen at the
/// same location for a long period of time.
typedef void GestureLongPressCallback();

/// Recognizes when the user has pressed down at the same location for a long
/// period of time.
class LongPressGestureRecognizer extends PrimaryPointerGestureRecognizer {
  /// Creates a long-press gesture recognizer.
  ///
  /// Consider assigning the [onLongPress] callback after creating this object.
  LongPressGestureRecognizer({ Object debugOwner }) : super(deadline: kLongPressTimeout, debugOwner: debugOwner);

  /// Called when a long-press is recognized.
  GestureLongPressCallback onLongPress;

  @override
  void didExceedDeadline() {
    resolve(GestureDisposition.accepted);
    if (onLongPress != null)
      invokeCallback<void>('onLongPress', onLongPress);
  }

  @override
  void handlePrimaryPointer(PointerEvent event) {
    if (event is PointerUpEvent)
      resolve(GestureDisposition.rejected);
  }

  @override
  String get debugDescription => 'long press';
}