1

In the documentation, RaisedButton has a property "enableFeedback", which controls "Whether detected gestures should provide acoustic and/or haptic feedback".

I'm trying to set enableFeedback: false in my Androd app, but it appears that this property doesn't exist for RaisedButton. I'm getting the following error: Error: No named parameter with the name 'enableFeedback'.

Is the documentation wrong?

What I want to do is to prevent my app to play a sound when a raised button is tapped (which it's doing right now).

edit: Workaround here. Use MaterialButton instead of RaisedButton. MaterialButton has, indeed, a enableFeedback property. Not perfect, though, since RaisedButton has better default styling for my purposes (e.g. disabledColor).

mvww11
  • 33
  • 4

3 Answers3

0

I checked github code for RaisedButon and that control never had that property. The class that do have enableFeedback is MaterialButton, the parent class of RaisedButon, but setting that property is not available trough constructor so it keeps the default value of true and you can't change it.

So the documentation is correct.. the property exists trough inheritance, it's just that you can't change the value.

Claudio Redi
  • 67,454
  • 15
  • 130
  • 155
0

FlatButton = TextButton (in new Flutter)

RaisedButton = ElevatedButton (in new Flutter)

TextButton(
style: ButtonStyle(
enableFeedback: false),

or

ElevatedButton(
    style: ButtonStyle(
    enableFeedback: false),
Asterix
  • 91
  • 1
  • 4
-1

Please change RaisedButton to ElevatedButton and then try it.

Qasim
  • 249
  • 1
  • 7