如何在Flutter中禁用默认的Widget飞溅效果? [英] How to disable default Widget splash effect in Flutter?

查看:60
本文介绍了如何在Flutter中禁用默认的Widget飞溅效果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在窗口小部件上禁用默认的飞溅/波纹/墨水效果?有时效果是不需要的,例如在以下TextField情况下:

How can I disable the default splash/ripple/ink effect on a Widget? Sometimes the effect is unwanted, such as in the following TextField case:

推荐答案

按照上面@hunter的建议,我发现通过将主题中的highlightColorsplashColor都设置为Colors.transparent可以消除波纹.

Per @hunter's suggestion above, I found that by setting both highlightColor and splashColor in my theme to Colors.transparent removed the ripple.

我确实担心设置highlightColor可能会产生连锁反应,但是我还没有注意到.

I do hold some concerns that setting highlightColor might have some knock-on effects, but I haven't noticed any yet.

这篇关于如何在Flutter中禁用默认的Widget飞溅效果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆