gpt4 book ai didi

Flutter TextButton splashColor属性

转载 作者:行者123 更新时间:2023-12-03 13:30:34 26 4
gpt4 key购买 nike

我正在使用FlatButton并传递了属性

FlatButton(
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
child: ...,
)
documentation says that FlatButton will become obsolete,并改为使用 TextButton,但它没有 splashColorhighlightColor属性
TextButton(                  
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
child: ...,
)
不起作用。不允许
我也这样尝试过
TextButton(            
style: ButtonStyle(
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
),
child: ...,
)
我怎样才能做到这一点?谢谢

最佳答案

Colors.transparent会拒绝任何效果,只是它是透明的,所以它什么也不会发生...在ButtonStyle中,它与颜色类似。

ButtonStyle(
overlayColor: MaterialStateColor.resolveWith((states) => Colors.red),
),

关于Flutter TextButton splashColor属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64380867/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com