Is there any way to mute click sound in android? I need to use my own sound effects.
Note: I don’t want to use gesture detector instead of default button widgets, because it affects plenty of my screens.
Answer
I didn’t find any property in default Flutter buttons.
But I think, I found the source of sound. This’s InkWell widget. I did the trick below and it helped me:
class SilentBtn extends StatelessWidget { @override Widget build(BuildContext context) { return Container( color: Colors.red, child: Material( child: InkWell( onTap: () => print('OnTap'), enableFeedback: false, child: Container( width: 50, height: 50, child: Center( child: Text( ':)', style: TextStyle(color: Colors.white, fontSize: 16), ), ), ), ), color: Colors.transparent, ), ); } }
If you set the ‘enableFeedback: false’ you won’t here click sound. If it’s true then the sound is hearable.