forLongPress method
Provides platform-specific feedback for a long press.
On Android the platform-typical vibration is triggered. On iOS this is a no-op as that platform usually doesn't provide feedback for long presses.
See also:
- wrapForLongPress to trigger platform-specific feedback before executing a GestureLongPressCallback.
Implementation
static Future<void> forLongPress(BuildContext context) {
context.findRenderObject().sendSemanticsEvent(const LongPressSemanticsEvent());
switch (_platform(context)) {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
return HapticFeedback.vibrate();
default:
return Future<void>.value();
}
}