【发布时间】:2021-08-04 09:53:47
【问题描述】:
我正在使用BottomNavigationBarItem 在我的底部栏中显示项目。现在我的问题是,我的 title 的内容太长并且没有正确显示。见这里:
是否有关于如何修复它的规范替代方案?还是我必须构建自己的自定义 BottomNavigationBarItem?
非常感谢!
编辑: 我的代码(不是很有趣)如下所示:
BottomBar(onTabTapped, currentIndex, context) {
this.onTap = onTabTapped;
this.currIndex = currentIndex;
items = <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.dashboard),
label: AppLocalizations.of(context).bottomBarDashboard,
),
BottomNavigationBarItem(
icon: Icon(Icons.book),
label: AppLocalizations.of(context).bottomBarMyArticles,
),
BottomNavigationBarItem(
icon: Icon(Icons.account_circle),
label: AppLocalizations.of(context).bottomBarProfile,
),
];
}
@override
Widget build(BuildContext context) {
return BottomNavigationBar(elevation: 2.0, selectedItemColor: Theme.of(context).primaryColor, items: items, onTap: onTap, currentIndex:
currIndex);
}
【问题讨论】:
-
可以使用
Meine Premium \n sample text也可以粘贴一些代码,这将非常有用且简单 -
@MKarimi Yeh,我也看到了这个问题。但我相信这是针对原生 iOS 的。
-
栏看起来很简单。我会用行和列重新创建一个:行,3 列,每个列有 2 行,一个带有图标,另一个带有文本。并使用 SizedBox 控制高度
标签: flutter flutter-bottomnavigation