- 바텀네비게이션 바가 4개
IndexedStack도 4개
네비게이션 바에 맞춰서 만들어야함
순서대로 그 페이지로 이동함
int _selectedIndex = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
body: IndexedStack(
index: _selectedIndex,
children: [
HomePage(),
ExplorePage(),
YourLibrayPage(),
ProfilePage(),
],
),
bottomNavigationBar: BottomNavigationBar(
showSelectedLabels: false,
showUnselectedLabels: false,
// currentIndex: (),
type: BottomNavigationBarType.fixed,
backgroundColor: Colors.black,
selectedItemColor: Colors.white,
unselectedItemColor: Colors.white38,
items: [
BottomNavigationBarItem(
icon: Icon(CupertinoIcons.home),
label: " ",
),
BottomNavigationBarItem(
icon: Icon(CupertinoIcons.search),
label: " ",
),
BottomNavigationBarItem(
icon: Icon(CupertinoIcons.bookmark),
label: " ",
),
BottomNavigationBarItem(
icon: Icon(CupertinoIcons.profile_circled),
label: " ",
),
],
currentIndex: _selectedIndex,
onTap: (index) {
setState(
() {
_selectedIndex = index;
},
);
},
)
- 바텀 네비게이션바
