显示图像在图像抖动上>>

问题描述 投票:0回答:2

需要在小部件边距之外的其他图像上方显示图像。

Requried output

我尝试使用堆栈,但没有从外面出来。

Stack(children: <Widget>[
                Container(
                  child: Image.asset('assets/discover.png'),
                ),
                Row(
                  children: <Widget>[
                    Expanded(child: Text(''), flex: 9),
                    Expanded(
                      child: ClipRRect(
                        borderRadius: new BorderRadius.circular(80.0),
                        child: Image.asset('assets/user.jpg'),
                      ),
                      flex: 6,
                    ),
                    Expanded(child: Text(''), flex: 9)
                  ],
                )

需要在小部件边距之外的其他图像上方显示图像。我尝试使用堆栈,但堆栈没有溢出。堆栈(孩子:[容器(孩子:...

flutter flutter-layout
2个回答
0
投票

下面的源代码适用于您的方案。您必须为图像容器提供顶部填充,并使整个堆栈的对齐方式为topCenter。

并且请提供圆圈图像的高度和宽度。


0
投票
Stack(children: <Widget>[
        Container(
          margin: EdgeInsets.only(top: 50.0),
          child: Image.network(
              'https://cdn.pixabay.com/photo/2015/06/19/21/24/the-road-815297__340.jpg'),
        ),
        Row(
          children: <Widget>[
            Expanded(child: Text(''), flex: 9),
            Expanded(
              child: ClipRRect(
                borderRadius: new BorderRadius.circular(80.0),
                child: Image.asset('assets/ic_profile.png'),
              ),
              flex: 6,
            ),
            Expanded(child: Text(''), flex: 9)
          ],
        )
      ]), 
© www.soinside.com 2019 - 2024. All rights reserved.