Flutter:如何使框内的按钮溢出?

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

我正在尝试复制此布局按钮enter image description here

我创建了一个带有容器和定位按钮的堆栈,但是我不能将按钮设置为开箱即用。

                  Stack(children: <Widget>[
                    Container(
                      decoration: new BoxDecoration(
                        shape: BoxShape.rectangle,
                        border: new Border.all(
                        color: Colors.black,
                        width: 1 
                        )
                      ),
                      child: Text("League of legends")
                    ),
                    Positioned(
                      right: 0,
                      bottom: 0,
                      child: Container(
                        width: 9,
                        height: 9,
                        child: new Container(
                          width: 9,
                          height: 9,
                          decoration: new BoxDecoration(
                            color: Colors.white,
                            shape: BoxShape.circle,
                          ),
                        ),
                      )
                    )
                  ])

我尝试添加填充,但没有成功。

我的代码的结果是这样的:enter image description here

flutter flutter-layout
1个回答
0
投票

Stack的构造函数具有overflow参数,使您可以选择是否在其边界之外绘制其子代。

通过将Overflow.visible传递到overflow并在rightbottom中设置负值,可以使圆圈开箱即用。

Positioned()

我将多余的嵌套容器减少为一个。

© www.soinside.com 2019 - 2024. All rights reserved.