9

Im making an app that play sounds when you press FlatButtons, and I want to disable the predetermined pop sound that plays every time you touch the screen.

Is there a way to do this?

Tapioca
  • 309
  • 3
  • 7

4 Answers4

5

you cant disable the sound for the flatbutton .you can use InkWell() Widget it offers you the methode enableFeedback . you can set it as false and you should be alright

4

Use MaterialButton. All the styling remains the same but you have the added benefit of implementing

enableFeedback: false,
which will remove the default click sound.
Tech House
  • 41
  • 2
  • Good suggestion! Flatbutton is deprecated in Flutter 2. MaterialButton is the best substitute for it. Thanks! – Osh Mansor Jul 04 '21 at 12:26
1

FlatButton = TextButton (in new Flutter)

TextButton(
style: ButtonStyle(
enableFeedback: false),

The same works with ElevatedButton

Asterix
  • 91
  • 1
  • 4
0

One of the idea is to use InkWell() widget instead.

Refer: How to mute the sound of buttons in application?

Adlan Arif Zakaria
  • 1,706
  • 1
  • 8
  • 13