flutter - 颤动卡片形状
问题描述
我以颤振画廊为例构建自己的卡片,但是在设置形状时,它说参数形状未定义。我不确定这是怎么可能的,因为我认为形状是 Card 类的默认属性?如果这是一个超级简单的修复,我很抱歉。我已经搞砸了几天了。
final ShapeBorder shape;
@override
Widget build(BuildContext context) {
return new SafeArea(
top: false,
bottom: false,
child: new Container(
padding: const EdgeInsets.all(8.0),
height: height,
child: new Card(
elevation: 8.0,
color: const Color(0xFFf0e7d1),
shape: shape, // The first shape is not defined, second is fine?
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new SizedBox(
height: 154.0,
child: new Stack(
children: <Widget>[
new Positioned.fill(
child: new Image.asset(
destination.assetName,
fit: BoxFit.cover,
),
),
new Positioned(
bottom: 16.0,
left: 16.0,
right: 16.0,
child: new FittedBox(
fit: BoxFit.scaleDown,
alignment: Alignment.centerLeft,
child: new Text(
destination.title
),
),
),
],
),
),
解决方案
好的,事实证明你实际上根本不需要一个 size 实现,所以我只是删除了它,一切都很好!
推荐阅读
- apache-spark - Pyspark 执行时出错
- javascript - 如何将 JavaScript 类实例与对象合并?
- regex - 难以理解正则表达式回溯
- java - 如何在 Wildfly 10 服务器上复制文件内容?
- wordpress - 循环遍历特定类别的产品
- rdf - 将 RDF 项目特征建模为子类或作为对其他个体的引用
- node.js - 护照-ldapauth 获取嵌套组
- angular - 来自 API $$_lazy_route_resource 的角度加载路由延迟递归错误
- arrays - 将列表解组到集合中
- javascript - 在 highchart 一般绘图中,使 svg 标签在鼠标悬停时可缩放