首页 > 解决方案 > 点击 IconButton() 时移除点击效果

问题描述

我目前正在使用以下代码IconButton()在 Flutter 中创建一个:

IconButton(
  hoverColor: Colors.transparent,
  color: _tweenButton.value,
  icon: Icon(Icons.send),
  onPressed: () => _isComposing ? _handleSubmitted(_textController.text) : null,
)

每当我单击图标按钮时,都会出现如此屏幕截图所示的飞溅/单击效果。这个小部件在MaterialApp()Scaffold().

如何停用此视觉效果?

标签: flutterdart

解决方案


使用此代码:

IconButton(
 splashColor: Colors.transparent,
 highlightColor: Colors.transparent,  
 color: _tweenButton.value,
 icon: Icon(Icons.send),
 onPressed: () => _isComposing ? _handleSubmitted(_textController.text) : null,
)


推荐阅读