将边框半径应用于 BottomNavigationBar
我需要将边框半径应用于 BottomNavigationBar 宽度。找到一个有效的解决方案很棘手 - 我需要稍后对栏应用更多样式,并且还需要一个与之兼容的解决方案(主要是:浮动操作按钮和阴影)。关于如何做有什么建议吗?
代码和屏幕:
看我有:
看看我需要:
代码:(在我的选项卡屏幕的支架中):
bottomNavigationBar: BottomNavigationBar(
onTap: _selectPage,
showSelectedLabels: false,
showUnselectedLabels: false,
currentIndex: _selectedPageIndex,
type: BottomNavigationBarType.fixed,
items: [
//home
BottomNavigationBarItem(
icon: Icon(Icons.home, color: _customColorScheme['Icon 1']),
activeIcon: Icon(Icons.home, color: _customColorScheme['Icon 2']),
label: '',
),
//favorite
BottomNavigationBarItem(
icon: Icon(Icons.favorite, color: _customColorScheme['Icon 1']),
activeIcon:
Icon(Icons.favorite, color: _customColorScheme['Icon 2']),
label: '',
),
//loockback
BottomNavigationBarItem(
icon: Icon(Icons.bar_chart, color: _customColorScheme['Icon 1']),
activeIcon:
Icon(Icons.bar_chart, color: _customColorScheme['Icon 2']),
label: '',
),
//info & support
BottomNavigationBarItem(
icon: Icon(Icons.info, color: _customColorScheme['Icon 1']),
activeIcon: Icon(Icons.info, color: _customColorScheme['Icon 2']),
label: '',
),
],
),
I need to apply a border radius to my BottomNavigationBar widet. It's tricky to find a solution that works - and I need to apply more stylings to the bar later on and need a solution that is compatible with that as well (mainly: Floating action button and a shadow). Any recommendation on how to do it?
Code and screens:
Look I have:
Look I need:
Code: (in the Scaffold of my tabs screen):
bottomNavigationBar: BottomNavigationBar(
onTap: _selectPage,
showSelectedLabels: false,
showUnselectedLabels: false,
currentIndex: _selectedPageIndex,
type: BottomNavigationBarType.fixed,
items: [
//home
BottomNavigationBarItem(
icon: Icon(Icons.home, color: _customColorScheme['Icon 1']),
activeIcon: Icon(Icons.home, color: _customColorScheme['Icon 2']),
label: '',
),
//favorite
BottomNavigationBarItem(
icon: Icon(Icons.favorite, color: _customColorScheme['Icon 1']),
activeIcon:
Icon(Icons.favorite, color: _customColorScheme['Icon 2']),
label: '',
),
//loockback
BottomNavigationBarItem(
icon: Icon(Icons.bar_chart, color: _customColorScheme['Icon 1']),
activeIcon:
Icon(Icons.bar_chart, color: _customColorScheme['Icon 2']),
label: '',
),
//info & support
BottomNavigationBarItem(
icon: Icon(Icons.info, color: _customColorScheme['Icon 1']),
activeIcon: Icon(Icons.info, color: _customColorScheme['Icon 2']),
label: '',
),
],
),
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以试试这个:
You can try this:
您可以使用一个包
animated_bottom_navigation_bar: ^0.3.2
它们有不同数量的导航栏,并且有一个您需要的圆角导航栏。我希望这能满足您的需求。You can use a package
animated_bottom_navigation_bar: ^0.3.2
they have various amount of navigation bars and have a rounded corner one that you need. I hope this will fulfill what you need.