Skip to content

HapticFeedback: Support UINotificationFeedbackType.success/warning/error on iOS #150029

@yuukiw00w

Description

@yuukiw00w

Use case

When notifying the user of the success or failure of an action through vibration, I would like to use the standard API on iOS.
As an alternative, I am currently using one of HapticFeedback's heavyImpact/lightImpact/mediumImpact/selectionClick/vibrate, but this does not provide the expected vibration feedback on iOS.

Proposal

iOS provides an API called UINotificationFeedbackGenerator, which is designed to notify users of the outcome of an action. While HapticFeedback currently supports three types of vibration (UIImpactFeedbackGenerator, UISelectionFeedbackGenerator, and kSystemSoundID_Vibrate), adding UINotificationFeedbackType’s success/warning/error would allow for standard vibration notifications for the success or failure of a user action. Therefore, it would be great if the following HapticFeedback API could be provided:

  • success(): UINotificationFeedbackType.success on iOS, HapticFeedbackConstants.CONFIRM on Android
  • warning(): UINotificationFeedbackType.warning on iOS, HapticFeedbackConstants.REJECT on Android
  • error(): UINotificationFeedbackType.error on iOS, HapticFeedbackConstants.REJECT on Android

Note that there may be room for discussion regarding warning(), as there is no direct equivalent on Android.

Metadata

Metadata

Assignees

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 Flutterframeworkflutter/packages/flutter repository. See also f: labels.platform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions