简体   繁体   English

按下时如何去除文本按钮上的蓝色阴影(Flutter)

[英]How to remove blue shadow on textbutton when it's pressed (Flutter)

I'd like to remove the shadow that appears when you press a text button on Flutter, I've looked everywhere and can't find an answer !我想删除在 Flutter 上按下文本按钮时出现的阴影,我到处找都找不到答案! Help me please !请帮帮我 ! Thank you !谢谢 !

You should check the documentation of TextButton and especially the styleButtonStyle .您应该检查TextButton的文档,尤其是styleButtonStyle You need to change the overlayColor as per documentation:您需要根据文档更改overlayColor

The highlight color that's typically used to indicate that the button is focused, hovered, or pressed.通常用于指示按钮处于焦点、悬停或按下状态的突出显示颜色。

Instead of using TextButton, I recommend you to use Text Widget using GestureDetector.我建议您使用 GestureDetector 来使用 Text Widget,而不是使用 TextButton。 So the Text is there is no shadow color.所以文本没有阴影颜色。

Example:例子:

GestureDetector(
    child: Text('Click me'),
    onTap: () {},
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM