shadcn_flutter
shadcn_flutter copied to clipboard
Disable tap SystemSound for iOS
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?
@sunarya-thito happy to submit a PR if this makes sense to you :D
@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
@jointhejourney are you planning a PR? I definitely need this too