Skip to content

Add onLongPressUp callback to InkWell to detect release after long press #173390

@houssemeddinefadhli81

Description

@houssemeddinefadhli81

Use case

Currently, Flutter’s InkWell widget supports onLongPress, but not a direct onLongPressUp callback. This makes it harder to distinguish the moment when a long press is released, especially if the developer wants to trigger logic only after a full long press and lift.

Why this is a good solution

This issue proposes adding an onLongPressUp callback to the InkWell widget, to be invoked when the user has performed a long press and then released their finger or mouse.

  • Consistency with existing gesture callbacks: GestureDetector supports onLongPressUp, but InkWell does not, despite being a common wrapper for interactions in Material apps.
  • Fine-grained control: Developers can now distinguish between the press and release of a long press, enabling more complex interaction patterns (e.g. preview on long press, action on release).
  • Prevents workaround hacks: Without onLongPressUp, developers are forced to combine InkWell with a GestureDetector or manage custom gesture logic to detect when a long press is released, which increases complexity and reduces code readability.

Proposal

Imagine a file manager app where a user long-presses a file to preview it and only wants to select the file if they release after a long press.

InkWell(
  onLongPress: () {
    // Show file preview
  },
  onLongPressUp: () {
    // Confirm selection only when user lifts after long press
    selectFile();
  },
  child: FileTile(file),
);

Metadata

Metadata

Labels

P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterf: gesturesflutter/packages/flutter/gestures repository.f: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions