【问题标题】:Button's animation on press happens not as required按钮的按下动画不是按要求发生的
【发布时间】:2021-08-05 21:05:50
【问题描述】:

有一个由这个组成的自定义按钮

RawMaterialButton(
     constraints: BoxConstraints.tightFor(width: 12),
     onPressed: null,
     child: IconButton(
     icon: const Icon(Icons.cancel, color: kActiveColor),
        onPressed: () => state.clear(),
     ),
),

但是按下时的动画并没有出现在按钮上,看起来很奇怪,如何解决?

【问题讨论】:

  • 你想达到什么样的结果?如果你只想要IconButton,这里不需要RawMaterialButton
  • 显示您尝试对齐此按钮的位置的完整代码会有所帮助。一般来说,将一个按钮包裹在另一个按钮中只是为了对齐它并不是一个解决方案。
  • @rozerro 我认为您还有另一个问题要解决差距问题。我在那里发布了一个答案,请检查一下。

标签: flutter


【解决方案1】:

您可以添加这些行以避免飞溅效果。

splashColor: Colors.transparent,  
highlightColor: Colors.transparent,
hoverColor: Colors.transparent,

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2021-04-09
  • 1970-01-01
  • 2012-06-24
  • 1970-01-01
  • 1970-01-01
  • 2020-03-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多