Skip to content

Feedback.forLongPress does not provide feedback on iOS #148391

@saibotma

Description

@saibotma

Steps to reproduce

Execute Feedback.forLongPress on an iOS device.
Or run the example on iOS and long press the screen.
Notice that it prints "Long-press started" to the console, but there is no feedback.

Expected results

Should provide haptic feedback. The documentation says "On iOS this is a no-op as that platform usually doesn't provide feedback for long presses.", however this is wrong from my point of view.
iOS gives feedback for long presses, for example when long pressing on a photo in the Photos app, or long pressing on a message in iMessage. The feedback includes a "tap" Sound, when sounds are enabled, and haptic feedback similar to HapticFeedback.heavyImpact().

I am not an iOS guy, so I would appreciate it if an iOS guy can provide his opinion on this topic.

Actual results

Does not provide haptic feedback and sound.

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: GestureDetector(
        onLongPressStart: (_) {
          print("Long-press started");
          Feedback.forLongPress(context);
          //HapticFeedback.heavyImpact();
        },
        child: Container(
          color: Colors.white,
          child: const Center(child: Text("Long-press me")),
        ),
      ),
    );
  }
}

Flutter Doctor output

Doctor output
[!] Flutter (Channel stable, 3.22.0, on macOS 14.1.1 23B81 darwin-arm64, locale en-DE)
    • Flutter version 3.22.0 on channel stable at /Users/tobias/dev/tools/flutter
    ! Warning: `flutter` on your path resolves to /Users/tobias/Dev/Tools/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at
      /Users/tobias/dev/tools/flutter. Consider adding /Users/tobias/dev/tools/flutter/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/3.2.2/libexec/bin/dart, which is not inside your current Flutter SDK checkout at
      /Users/tobias/dev/tools/flutter. Consider adding /Users/tobias/dev/tools/flutter/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5dcb86f68f (6 days ago), 2024-05-09 07:39:20 -0500
    • Engine revision f6344b75dc
    • Dart version 3.4.0
    • DevTools version 2.34.3
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/tobias/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/tobias/Library/Android/sdk
    • Java binary at: /Users/tobias/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.3)
    • Android Studio at /Users/tobias/Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.1.1)
    • IntelliJ at /Users/tobias/Applications/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 79.0.3
    • Dart plugin version 241.15989.9

[✓] VS Code (version 1.89.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (5 available)
    • Pixel 7 (mobile)                • 2B181FDH2001W8                           • android-arm64  • Android 14 (API 34)
    • iPhone X Testgerät (mobile)     • c6337498544ef0daff2c5057749efcdd8118d350 • ios            • iOS 16.7.7 20H330
    • macOS (desktop)                 • macos                                    • darwin-arm64   • macOS 14.1.1 23B81 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                    • darwin         • macOS 14.1.1 23B81 darwin-arm64
    • Chrome (web)                    • chrome                                   • web-javascript • Google Chrome 124.0.6367.203

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listf: material designflutter/packages/flutter/material repository.found in release: 3.22Found to occur in 3.22frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyr: 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