【问题标题】:How to group card with two images together?如何将带有两张图片的卡片组合在一起?
【发布时间】:2022-08-17 18:44:53
【问题描述】:

我想要的设计:

我目前的设计:

如何去除白色背景,只显示图像。有人知道吗?

我的代码:

 new Column(
                        mainAxisAlignment: MainAxisAlignment.start,
                        children: <Widget>[
                          Stack(
                            children: [
                              new Card(
                                child: new Container(
                                  child: new Image.asset(
                                    \'assets/images/front_Page_Image.png\',
                                    height: 746,
                                    width: constraints.maxWidth * 0.64,
                                    fit: BoxFit.cover,
                                  ),
                                ),
                              ),
                              new Card(
                                child: new Container(
                                  alignment: Alignment.topLeft,
                                  child: new Image.asset(
                                      \'assets/images/half_circle.png\'),
                                ),
                              )
                            ],
                          ),
                        ],
                      ),
  • 您的第二个图像资产是否具有白色背景?分享图片。
  • 使用堆栈,将孩子放在堆栈中。设置背景图片,然后在上面设置一个不透明的圆圈,最后是文字!!

标签: flutter dart


【解决方案1】:

我认为您不应该将它们包装在Card 中。第一个Container 也毫无用处。所以喜欢

Column(
  mainAxisAlignment: MainAxisAlignment.start,
  children: <Widget>[
    Stack(
      children: [
        Image.asset(
          'assets/images/front_Page_Image.png',
          height: 746,
          width: constraints.maxWidth * 0.64,
          fit: BoxFit.cover,
        ),
        Container(
          alignment: Alignment.topLeft,
          child: Image.asset(
              'assets/images/half_circle.png'),
        )
      ],
    ),
  ],
)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-19
    • 2011-11-04
    • 1970-01-01
    • 1970-01-01
    • 2022-12-11
    • 2013-03-05
    • 1970-01-01
    相关资源
    最近更新 更多