我创建了一个带有容器和定位按钮的堆栈,但是我不能将按钮设置为开箱即用。
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,
),
),
)
)
])
我尝试添加填充,但没有成功。
Stack
的构造函数具有overflow
参数,使您可以选择是否在其边界之外绘制其子代。
通过将Overflow.visible
传递到overflow
并在right
和bottom
中设置负值,可以使圆圈开箱即用。
Positioned()
我将多余的嵌套容器减少为一个。