【发布时间】:2018-11-02 16:01:45
【问题描述】:
我以颤振画廊为例构建自己的卡片,但是在设置形状时,它说参数形状未定义。我不确定这是怎么可能的,因为我认为形状是 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
),
),
),
],
),
),
【问题讨论】: