我想从一个透明的可点击容器中删除涟漪效果,但无论我做什么效果都不会消失,请帮助!代码:
InkWell( onTap: (){print('Tapped');}, child: Container( height: 200, width: 200,),)
ktca8awb1#
使用GestureDetector代替:
GestureDetector
GestureDetector( onTap: () {print('Tapped');}, child: Container( height: 200, width: 200, ), )
eoxn13cs2#
在您的材料应用程序小部件ThemeData中放置以下行
highlightColor: Colors.transparent, hoverColor: Colors.transparent, splashColor: Colors.transparent, splashFactory: NoSplash.splashFactory,
喜欢
theme: ThemeData( highlightColor: Colors.transparent, hoverColor: Colors.transparent, splashColor: Colors.transparent, splashFactory: NoSplash.splashFactory, )
qlzsbp2j3#
我是这样使用它的:
InkWell( excludeFromSemantics: true, canRequestFocus: false, enableFeedback: false, splashFactory: NoSplash.splashFactory, splashColor: Colors.transparent, highlightColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, overlayColor: MaterialStateProperty.all(Colors.transparent), onTap: widget.onPressed, child: child, );
smdnsysy4#
使用GestureDetector而不是InkWell,因为Inkwell默认提供涟漪效果,因此您可以使用GestureDetector。
InkWell
4条答案
按热度按时间ktca8awb1#
使用
GestureDetector
代替:eoxn13cs2#
在您的材料应用程序小部件ThemeData中放置以下行
喜欢
qlzsbp2j3#
我是这样使用它的:
smdnsysy4#
使用
GestureDetector
而不是InkWell
,因为Inkwell默认提供涟漪效果,因此您可以使用GestureDetector。