【发布时间】:2019-10-05 12:55:34
【问题描述】:
我正在使用 align 在我的堆栈中定位小部件。当我在堆栈内的任何孩子中使用对齐时,堆栈将占据全屏。否则堆栈是最高的孩子的高度。我在这里很困惑。 align 不是用来对齐栈内的children吗?
这是我的代码:
bottomNavigationBar: Stack(
children: <Widget>[
Container(
color: Colors.greenAccent,
width: double.infinity,
height: 45,
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
width: 80,
height: 80,
decoration: BoxDecoration(color: Colors.deepPurpleAccent, shape: BoxShape.circle),
child: IconButton(icon: Icon(Icons.search), onPressed: (){}),
),
)
],
)
现在,当我从第二个孩子中移除 Align 小部件时,堆栈与其孩子一样大。
【问题讨论】:
标签: flutter