Flutter:Inkwell不适用于Card

编程入门 行业动态 更新时间:2024-10-26 02:30:18
本文介绍了Flutter:Inkwell不适用于Card的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试在卡片小部件上实现包装并对其进行包装,但是它根本不起作用.我将Tap保留为null,因为此类使用3个参数,稍后将其填充以生成多个卡. 我看不到发生了什么,这阻止了InkWell的崩溃,因此,我们将不胜感激.

I am trying to implement and inkWell wrap on a card widget, but it does not work at all. I am leaving on tap as null because this class takes 3 arguments that I populate later on to generate multiple cards. I cannot see what is going on that is preventing InkWell from rippling, so any help would be appreciated.

class FeedBackCardsImage extends StatelessWidget { final String imagePath; final String cardTitle; final String cardTag; FeedBackCardsImage({ this.imagePath, this.cardTitle, this.cardTag, }); @override Widget build(BuildContext context) { return InkWell( child: new Container( child: new Card( child: new Padding( padding: new EdgeInsets.all(15.0), child: new Column( children: <Widget>[ new SizedBox( height: 184.0, child: new Stack( children: <Widget>[ new Positioned.fill( child: new Image.asset( imagePath, //package: destination.assetPackage, fit: BoxFit.contain, ), ), ], ), ), new Padding( padding: new EdgeInsets.all( 7.0, ), child: new Text( cardTitle, style: new TextStyle( fontSize: 14.0, fontWeight: FontWeight.w600, color: Colors.black87), ), ), new Padding( padding: new EdgeInsets.all( 0.0, ), child: new Text( cardTag, style: new TextStyle( fontSize: 12.0, fontWeight: FontWeight.w400, color: Colors.black54), ), ), ], ), ), ), ), onTap: null, ); }

推荐答案

说明:

"正在发生的情况是,材料"规范指出飞溅是 实际在材料上墨水.所以当我们飞溅时,我们要做的就是 确实让Material小部件发挥作用.如果你有 在材料顶部的东西,我们在它下面飞溅,而您不能 看到它."

"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."

解决方法:

return Stack(children: <Widget>[ new Card( child: new Padding( padding: new EdgeInsets.all(15.0), child: new Column( children: <Widget>[ new SizedBox( height: 184.0, child: new Stack( children: <Widget>[ new Positioned.fill( child: new Image.asset( imagePath, //package: destination.assetPackage, fit: BoxFit.contain, ), ), ], ), ), new Padding( padding: new EdgeInsets.all( 7.0, ), child: new Text( cardTitle, style: new TextStyle( fontSize: 14.0, fontWeight: FontWeight.w600, color: Colors.black87), ), ), new Padding( padding: new EdgeInsets.all( 0.0, ), child: new Text( cardTag, style: new TextStyle( fontSize: 12.0, fontWeight: FontWeight.w400, color: Colors.black54), ), ), ], ), ), ), new Positioned.fill( child: new Material( color: Colors.transparent, child: new InkWell( onTap: () => null, ))) ]);

更多推荐

Flutter:Inkwell不适用于Card

本文发布于:2023-11-27 05:07:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636722.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不适用于   Flutter   Inkwell   Card

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!