【问题标题】:Flutter Card Shape颤振卡片形状
【发布时间】: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
                      ),
                    ),
                  ),
                ],
              ),
            ),

【问题讨论】:

    标签: flutter flutter-layout


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2022-07-27
      • 1970-01-01
      • 2021-04-20
      • 2021-09-16
      • 1970-01-01
      • 2018-09-13
      • 2019-12-04
      • 1970-01-01
      • 2020-05-09
      相关资源
      最近更新 更多