本文主要是介绍flutter中InkResponse和InkWell取消水波纹的方法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
因为InkWell继承自InkResponse,因此这里只以InkResponse来进行分析。
第一种方法:
在InkResponse外围添加Container,然后在Container中添加color属性,例子如下:
return Scaffold(
appBar: AppBar(
title: Text("title"),
),
body: Container(
child: InkResponse(
child: Padding(
padding: EdgeInsets.all(20),
child: Text("click me",style: TextStyle(color: Colors.black),),
),
onTap: () {
print("object");
},
),
color: Colors.red,
),
);
第二种方法:
设置InkResponse的highlightColor为透明,同时设置radius为0,代码如下:
return Scaffold(
appBar: AppBar(
title: Text("title"),
),
body: InkResponse(
highlightColor: Colors.transparent,
radius: 0.0,
child: Padding(
padding: EdgeInsets.all(20),
child: Text(
"click me",
style: TextStyle(color: Colors.black),
),
),
onTap: () {
print("object");
},
),
);
第三种方法:使用 GestureDetector 组件 里面也有ontag 点击方法
这篇关于flutter中InkResponse和InkWell取消水波纹的方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!