gpt4 book ai didi

flutter : align icon to the middle -- bottom navigation bar

转载 作者:行者123 更新时间:2023-12-05 09:12:36 32 4
gpt4 key购买 nike

我的 flutter 应用程序中有一个底部导航栏。如何将图标对齐到中间。目前,它似乎是顶部对齐

Widget _bottomNavigationBar(int selectedIndex) {
return BottomNavigationBar(
backgroundColor: Palette.YELLOW,
onTap: (int index) {
setState(() {
userModel.selectedIndex = index;
});
},
currentIndex: userModel.selectedIndex,
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Image.asset(
"assets/images/search_nav_icon.png",

),
title: Text(''),
),
BottomNavigationBarItem(
icon: Image.asset(
"assets/images/fav_nav_icon.png",

),
],
);
}

enter image description here

最佳答案

当使用图标而没有文本时,这对我有用。

返回底部导航栏( showSelectedLabels: false, showUnselectedLabel: false, //...);

关于 flutter : align icon to the middle -- bottom navigation bar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57734672/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com