首页 文章

扑动卡形状

提问于
浏览
1

我使用颤动画廊作为示例构建自己的卡片,但是在设置形状时它表示参数形状未定义 . 我不确定这是怎么可能的,因为我在印象形状下是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
                      ),
                    ),
                  ),
                ],
              ),
            ),

1 回答

  • 0

    好吧,事实证明你根本不需要一个大小的实现,所以我只是删除它,一切都很好!

相关问题