如何在Flutter中仅为TextField禁用splashColor?

3

我正在尝试在TextField上禁用涟漪效果。

splashColor:Colors.transparent 同时移除了其他小部件上的涟漪效果。

我只希望在TextField上移除涟漪效果。

1个回答

6
尝试这种方法,只需将Theme添加到TextField即可。
Theme(
  data: Theme.of(context).copyWith(splashColor: Colors.transparent),
  child: TextField(),
),

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接