Sun*_*sam 5 flutter bottomnavigationview
I've tried the following and got the out, but the body went blank. Is there any way to add a coloumn or a listview inside a bottom navigation bar
Column(
mainAxisAlignment:MainAxisAlignment.end,
children: <Widget>[
Row(
children: <Widget>[
Expanded(
//button1
),
Expanded(
//button2
),
Expanded(
//button3)
),
Row(
children: <Widget>[
Expanded(
//button4
),
Expanded(
//button5)
],
)
],
),
Run Code Online (Sandbox Code Playgroud)
除了 Expanded 小部件带来的问题(如alexandreohara 的回答中指出的那样),
Column 的mainAxisSize属性MainAxisSize.max默认设置为。这意味着该列将尝试占据所有可用空间(整个屏幕高度)。
将 Column 设置mainAxisSize为MainAxisSize.min将包裹 Column 小部件以占据尽可能少的空间(垂直)而不是跨越整个屏幕。
以下是可以完成的方法:
柱子(
mainAxisSize: MainAxisSize.min,
孩子们: [...]
);
小智 1
在 BottomNavigationBar 中使用 Column 没有问题。我认为你的问题是将所有内容都包装在 Expanded 中。它不知道内部小部件的宽度,因此,它将返回空白。
尝试删除那些扩展的小部件并尝试以下操作:
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween
children: [FlatButton(...), FlatButton(...)],
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1692 次 |
| 最近记录: |