如何在 bottomBar 导航中的两个升高的按钮之间创建间距?
How do I create a spacing between two elevated buttons in bottomBar Navigation?
我对如何使填充看起来更友好感到困惑。我还想在底部导航栏上的所有 3 个项目之间保持对称距离。我该怎么做?
在 2 Widgets
之间使用 SizedBox
const SizedBox(width: 16.0),
或一个 Widget
用 Padding
包裹并给一侧 填充,如左或右
const Padding(padding: EdgeInsets.only(right: 16.0)),
或在 2 Widgets
之间使用 Spacer
const Spacer(),
或者您可以在 Row Widgets
中使用
Row(
// you can use anyone of them, this properties space given equally according properties
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text("Text 1"),
Text("Text 2"),
Text("Text 3"),
]
)
在 Row() 小部件中添加 mainAxisAlignment: MainAxisAlignment.spaceAround,
,这将确保 children 周围有相同的 space。
我对如何使填充看起来更友好感到困惑。我还想在底部导航栏上的所有 3 个项目之间保持对称距离。我该怎么做?
在 2 Widgets
SizedBox
const SizedBox(width: 16.0),
或一个 Widget
用 Padding
包裹并给一侧 填充,如左或右
const Padding(padding: EdgeInsets.only(right: 16.0)),
或在 2 Widgets
Spacer
const Spacer(),
或者您可以在 Row Widgets
Row(
// you can use anyone of them, this properties space given equally according properties
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text("Text 1"),
Text("Text 2"),
Text("Text 3"),
]
)
在 Row() 小部件中添加 mainAxisAlignment: MainAxisAlignment.spaceAround,
,这将确保 children 周围有相同的 space。