shadcn_flutter icon indicating copy to clipboard operation
shadcn_flutter copied to clipboard

Disable tap SystemSound for iOS

Open jointhejourney opened this issue 1 year ago • 3 comments

Hi,

I noticed any clickable elements make a sound on iOS, however it should only be applicable to Android and Fuchsia.

Here's the equivalent behavior on Flutter's Feedback.forTap method: https://api.flutter.dev/flutter/widgets/Feedback/forTap.html

static Future<void> forTap(BuildContext context) async {
  context.findRenderObject()!.sendSemanticsEvent(const TapSemanticEvent());
  switch (defaultTargetPlatform) {
    case TargetPlatform.android:
    case TargetPlatform.fuchsia:
      return SystemSound.play(SystemSoundType.click);
    case TargetPlatform.iOS:
    case TargetPlatform.linux:
    case TargetPlatform.macOS:
    case TargetPlatform.windows:
      return Future<void>.value();
  }
}

Or better yet, enable the sound via the theme configuration. Wdyt?

jointhejourney avatar Apr 11 '25 07:04 jointhejourney

@sunarya-thito happy to submit a PR if this makes sense to you :D

jointhejourney avatar Apr 13 '25 18:04 jointhejourney

@sunarya-thito happy to submit a PR if this makes sense to you :D

Sorry for the slow response, but if you're willing to do this that'd be amazing

sunarya-thito avatar Apr 14 '25 10:04 sunarya-thito

@jointhejourney are you planning a PR? I definitely need this too

skiunke avatar Nov 09 '25 12:11 skiunke