User interface 如何在颤振中对齐选项卡栏的元素?

User interface 如何在颤振中对齐选项卡栏的元素?,user-interface,flutter,dart,uitabbar,user-experience,User Interface,Flutter,Dart,Uitabbar,User Experience,我有一个带有三个选项的选项卡/导航栏。但是它中的图标没有在中间对齐。图标在其他设备上看起来是对齐的,但在iPhone上却没有。由于某种原因,它们似乎被向上推了一点 Widget _bottomNavigationBar(int selectedIndex) => Container( height: 90, decoration: BoxDecoration( borderRadius

我有一个带有三个选项的选项卡/导航栏。但是它中的图标没有在中间对齐。图标在其他设备上看起来是对齐的,但在iPhone上却没有。由于某种原因,它们似乎被向上推了一点

  Widget _bottomNavigationBar(int selectedIndex) => 
        Container(
            height: 90,
                decoration: BoxDecoration(
              borderRadius: const BorderRadius.only(
                  topLeft: Radius.circular(52.0),
                  topRight: Radius.circular(52.0)),
              boxShadow: <BoxShadow>[
                BoxShadow(
                  color: Colors.black.withOpacity(0.5),
                  offset: Offset(-5, 5),
                  blurRadius: 20,
                ),
              ],
            ),
            child: ClipRRect(
              borderRadius: BorderRadius.only(
                  topLeft: Radius.circular(52.0),
                  topRight: Radius.circular(52.0)),
              child: BottomNavigationBar(
                selectedItemColor: Color(0xFFFE524B),
                unselectedItemColor: Color(0xFFFF8C3B),
                onTap: (int index) => setState(() => _selectedIndex = index),
                currentIndex: selectedIndex,
                items: const <BottomNavigationBarItem>[
                  BottomNavigationBarItem(
                      icon: Icon(
                        Entypo.home,
                        size: 28,
                      ),
                      title: Text('')),
                  BottomNavigationBarItem(
                      icon: Icon(
                        Entypo.game_controller,
                        size: 28,
                      ),
                      title: Text('')),
                  BottomNavigationBarItem(
                      icon: Icon(
                        Entypo.wallet,
                        size: 28,
                      ),
                      title: Text('')),
                ],
              ),
            )); 
Widget\u底部导航栏(int-selectedIndex)=>
容器(
身高:90,
装饰:盒子装饰(
borderRadius:仅限常量borderRadius(
左上:半径。圆形(52.0),
右上角:半径。圆形(52.0)),
boxShadow:[
箱形阴影(
颜色:颜色。黑色。不透明度(0.5),
偏移量:偏移量(-5,5),
半径:20,
),
],
),
孩子:ClipRRect(
borderRadius:仅限borderRadius(
左上:半径。圆形(52.0),
右上角:半径。圆形(52.0)),
子项:底部导航栏(
选择EditemColor:Color(0xFFFE524B),
unselectedItemColor:Color(0xFFFF8C3B),
onTap:(int index)=>setState(()=>_selectedIndex=index),
currentIndex:selectedIndex,
项目:常数[
底部导航气压计(
图标:图标(
安蒂波之家,
尺码:28,
),
标题:文本(“”)),
底部导航气压计(
图标:图标(
Entypo.game_控制器,
尺码:28,
),
标题:文本(“”)),
底部导航气压计(
图标:图标(
钱包,
尺码:28,
),
标题:文本(“”)),
],
),
)); 

谢谢你的帮助

这是因为底部导航栏中有“标题”。基本上,它是用一个空字符串呈现一个文本小部件。不是因为它是空的,而是它占据了空间

好消息是BottomNavBar类中的title属性接受一个小部件,因此,您可以将任何小部件传递给它

我建议传递一个零填充的填充小部件,或者可能传递一个零高度的容器。 实现可以如下所示:

BottomNavigationBarItem(
                      icon: Icon(
                        Entypo.home,
                        size: 28,
                      ),
                      title: Padding(padding: EdgeInsets.all(0.0))),
                  BottomNavigationBarItem(
                      icon: Icon(
                        Entypo.game_controller,
                        size: 28,
                      ),
                      title: Padding(padding: EdgeInsets.all(0.0))),
                  BottomNavigationBarItem(
                      icon: Icon(
                        Entypo.wallet,
                        size: 28,
                      ),
                      title: Padding(padding: EdgeInsets.all(0.0))),
                ],
              ),

伟大的工作完美