Skip to content

chore!: Kill legacy Force Press event API - #3989

Open
luanpotter wants to merge 1 commit into
mainfrom
luan.kill-force-press
Open

chore!: Kill legacy Force Press event API#3989
luanpotter wants to merge 1 commit into
mainfrom
luan.kill-force-press

Conversation

@luanpotter

Copy link
Copy Markdown
Member

Description

Kill legacy Force Press event API, with no replacement.

It was a niche API, only available on some older Apple's 3D Touch devices; the iPhone XS and XS Max (2018) were the last models to include it (see Apple's Models with 3D Touch, a list that Apple even stopped carrying forward after the iOS 14 guide). Every iPhone since, starting with the XR, uses Haptic Touch, which responds to how long a press lasts rather than how hard it is, and so never produces these callbacks. Only a handful of Android devices ever supported it, and some of those (such as the Pixel 2 and 3) have faux pressure sensors that never fired the callbacks anyway.

Combined with force press being the last gesture without an equivalent on the component-level event system, maintaining it was no longer worth the surface area.

If you do still target a 3D Touch device, the gesture remains fully available from Flutter: wrap your GameWidget in a
GestureDetector and use its onForcePressStart, onForcePressPeak, onForcePressUpdate and onForcePressEnd callbacks directly.

Checklist

  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

@luanpotter
luanpotter marked this pull request as ready for review August 7, 2026 13:19
@luanpotter
luanpotter requested review from spydon and a lite review from Copilot August 7, 2026 13:19
@luanpotter

Copy link
Copy Markdown
Member Author

Replacing #3986 - killing it instead

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes Flame’s legacy game-level Force Press gesture API (ForcePressDetector/ForcePressInfo) and all associated wiring, reflecting the near-total lack of Force Touch hardware support and reducing public surface area ahead of the next major migration.

Changes:

  • Removed ForcePressDetector mixin and ForcePressInfo event wrapper from the gestures API.
  • Removed Force Press recognizer registration from GameWidget gesture setup and related hit-test plumbing.
  • Removed Force Press tests and updated documentation (migration + gesture input docs) to reflect the removal.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/flame/test/gestures/detectors_test.dart Removes Force Press detector tests and the dedicated test game.
packages/flame/lib/src/gestures/events.dart Removes ForcePressInfo event wrapper type.
packages/flame/lib/src/gestures/detectors.dart Removes ForcePressDetector mixin and its handler methods.
packages/flame/lib/src/game/game_widget/gesture_detector_builder.dart Removes Force Press gesture recognizer registration for games.
packages/flame/lib/src/game/flame_game.dart Removes Force Press from the “gesture-detectors imply full-surface hit” logic.
packages/flame/lib/events.dart Stops exporting ForcePressDetector and ForcePressInfo from the public events barrel.
doc/flame/migration.md Adds migration guidance about the removal and Flutter-level alternative.
doc/flame/inputs/gesture_input.md Removes ForcePressDetector from the documented detectors list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread doc/flame/migration.md
Comment thread doc/flame/migration.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants