【发布时间】:2022-12-12 12:23:10
【问题描述】:
List navScreens = [
const HomeScreen(),
const FavoriteScreen(),
const NotificationScreen(),
const MyProfilesScreen(),
];
Scaffold(
body: navScreens.elementAt(selectedIndex),
bottomNavigationBar: BottomNavigationBar(
currentIndex: selectedIndex,
iconSize: 34,
selectedItemColor: ConstColors.green,
unselectedItemColor: ConstColors.black2,
elevation: 10,
onTap: (value) {
setState(() {
selectedIndex = value;
});
},
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.home_outlined), label: 'home'),
BottomNavigationBarItem(
icon: Icon(Icons.bookmark_border_outlined), label: 'favorite'),
BottomNavigationBarItem(
icon: Icon(Icons.notifications_none), label: 'notificati`your text`on'),
BottomNavigationBarItem(``your text``
icon: Icon(Icons.person_outline), label: 'profile'),
],
),
);
当我将屏幕从 BottomNavBar(MainScreen) 切换到内部 (DetailScreen) 时,BottomNavBar 就会消失。如果我直接从嵌套屏幕导航到底部栏屏幕。它也消失了。 Persistent_bottom_bar 是另一种解决方案,但我想通过内置支持修复它。谢谢 !
【问题讨论】:
标签: flutter flutter-navigation