class _MyHomePageState extends State<MyHomePage> { @overrIDe Widget build(BuildContext context) { return new Scaffold( appbar: new Appbar( Title: new Text(Widget.Title),),body: new Center( child: new InkWell( onTap: (){print("tapped");},child: new Container( wIDth: 100.0,height: 100.0,color: colors.orange,); }}
我尝试将InkWell放入容器内,但是徒劳无功.
解决方法 我认为在容器中添加颜色可以覆盖墨水效果https://docs.flutter.io/flutter/material/InkWell/InkWell.html
这段代码似乎有效
body: new Center( child: new Container( child: new Material( child: new InkWell( onTap: (){print("tapped");},child: new Container( wIDth: 100.0,color: colors.transparent,
只需点击中间的方块.
编辑:我找到了BUG报告. https://github.com/flutter/flutter/issues/3782
This is actually as expected,though we should update the docs to make it clearer.
What’s going on is that the Material spec says that the splashes are actually ink on the Material. So when we splash,what we do is we literally have the Material Widget do the splash. If you have something on top of the Material,we splash under it,and you can’t see it.
I have wanted to add a “Materialimage” Widget which conceptually prints its image into the Material as well,so that then the splashes would be over the image. We Could have a Materialdecoration which does something similar for a decoration. Or we Could have Material itself take a decoration. Right Now it takes a color,but we Could extend that to taking a whole decoration. It’s not clear whether it’s really material-spec-compatible to have a material with a gradIEnt,though,so I’m not sure whether we should do that.
On the short run,if you just need a workaround,you can put a Material on top of the container,with the material set to use the “transparency” type,and then put the ink well insIDe that.
–hixIE
总结以上是内存溢出为你收集整理的颤动 – InkWell没有出现涟漪效应全部内容,希望文章能够帮你解决颤动 – InkWell没有出现涟漪效应所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)