positioned_tap_detector 1.0.2

  • README.md
  • Example
  • Installing
  • Versions
  • 85


pub package

Flutter widget allowing to receive tap callbacks, together with their position on the screen. It supports onTap, onDoubleTap and onLongPress gestures. Each callback function is invoked with TapPosition object that provides global and relative touch position. To adjust maximum time allowed between double-tap gesture consecutive taps, specify an additional doubleTapDelay parameter:

  onTap: (position) => _printTap('Single tap', position),
  onDoubleTap: (position) => _printTap('Double tap', position),
  onLongPress: (position) => _printTap('Long press', position),
  doubleTapDelay: Duration(milliseconds: 500),
  child: ...,

void _printTap(String gesture, TapPosition position) => 
    print('$gesture: ${position.global}, ${position.relative}');

PositionedTapDetector demo


In case you need to wrap another GestureDetector below in the widget tree, pass an additional PositionedTapController parameter and invoke its callback methods whenever relevant gesture takes place:

final _controller = PositionedTapController();

Widget build(BuildContext context) {
  // ...
    child: PositionedTapDetector(
      // ...
      controller: _controller,
      child: GestureDetector(
        onTap: _handleTap,
        onTapDown: _controller.onTapDown,
        onLongPress: _controller.onLongPress,
        behavior: ...,
        child: ...,

void _handleTap() {
  // ...


PositionedTapDetector will not invoke onDoubleTap callback in case there's GestureDetector underneath it in the widget tree that also specifies onDoubleTap parameter. Since Flutter framework doesn't invoke its onTapDown callback when detector is double-tapped, positioned detector is unable to receive tap positions and therefore detect double-tap gestures.

[1.0.2] - 14/12/2018

  • Add HitTestBehavior field

[1.0.1] - 25/09/2018

  • Partially support nested GestureDetectors

[1.0.0] - 20/09/2018

  • Support onTap, onDoubleTap and onLongPress gestures



Positioned tap detector example.

Getting Started

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  positioned_tap_detector: ^1.0.2

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:positioned_tap_detector/positioned_tap_detector.dart';
Version Uploaded Documentation Archive
1.0.2 Dec 14, 2018 Go to the documentation of positioned_tap_detector 1.0.2 Download positioned_tap_detector 1.0.2 archive
1.0.1 Sep 25, 2018 Go to the documentation of positioned_tap_detector 1.0.1 Download positioned_tap_detector 1.0.1 archive
1.0.0+2 Sep 21, 2018 Go to the documentation of positioned_tap_detector 1.0.0+2 Download positioned_tap_detector 1.0.0+2 archive
1.0.0+1 Sep 21, 2018 Go to the documentation of positioned_tap_detector 1.0.0+1 Download positioned_tap_detector 1.0.0+1 archive
1.0.0 Sep 20, 2018 Go to the documentation of positioned_tap_detector 1.0.0 Download positioned_tap_detector 1.0.0 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Dec 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7
  • Flutter: 1.0.0


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs (-9.05 points)

19 out of 21 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies