轻按(颤振)禁用FlatButton声音

时间:2019-08-21 05:53:24

标签: flutter dart

我正在制作一个可以在您按下FlatButtons时播放声音的应用,而我想禁用每次触摸屏幕时都会播放的预定的流行声音。

有没有办法做到这一点?

3 个答案:

答案 0 :(得分:2)

使用 MaterialButton 。所有样式保持不变,但是您可以实现

enableFeedback: false,
,这将带来额外的好处,这将删除默认的点击声音。

答案 1 :(得分:0)

其中一个想法是改用InkWell()小部件。

引用:How to mute the sound of buttons in application?

答案 2 :(得分:0)

您无法禁用flatbutton的声音。您可以使用InkWell()小部件,它为您提供方法enableFeedback。您可以将其设置为false并且应该没问题