作者:杨子忧愁_347 | 来源:互联网 | 2022-12-09 17:17
1> diegoveloper..:
说明:
“发生的事情是Material规范说飞溅实际上是在Material上的墨水。因此,当我们飞溅时,我们所做的就是从字面上使Material部件执行飞溅。如果您在Material顶部有东西,我们溅在它下面,你看不到它。”
解决方法:
return Stack(children: [
new Card(
child: new Padding(
padding: new EdgeInsets.all(15.0),
child: new Column(
children: [
new SizedBox(
height: 184.0,
child: new Stack(
children: [
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,
)))
]);
这应该是公认的答案!但是,您可以更好地解释实际解决方案。您使用定位元素覆盖整个卡片,并在该定位元素上显示墨水瓶。
2> John..:
我终于通过在父卡小部件和子墨槽小部件中指定相同的边界半径来使此工作正常。其他解决方案不能正确渲染墨水孔动画的圆角。下面对我来说很完美:
Card(
elevation: 2,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
child: InkWell(
borderRadius: BorderRadius.circular(8),
onTap: (){},
child: Container(
height: 58,
),
),
);