-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterf: gesturesflutter/packages/flutter/gestures repository.flutter/packages/flutter/gestures repository.f: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
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
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterf: gesturesflutter/packages/flutter/gestures repository.flutter/packages/flutter/gestures repository.f: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team