I tried to implement a custom bottom navigation bar. I use a pageview to navigate between the pages. Now the bottom navigation bar is not absolutely above the page view but cuts off part of the page view. Can anyone help me here?
Here is the associated code:
Scaffold buildHomePage() {
return Scaffold(
body: PageView(
children: <Widget>[
PopularScreen(),
DiscoverScreen(),
ActivityScreen(),
ProfileScreen()
],
controller: pageController,
onPageChanged: onPageChanged,
physics: NeverScrollableScrollPhysics(),
),
bottomNavigationBar: buildBottomNavigationBar(),
);
}
Widget buildBottomNavigationBar() {
return BottomAppBar(
child: Container(
height: 65,
margin: EdgeInsets.only(left: 30, bottom: 40, right: 30),
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.black12,
blurRadius: 5,
)
],
color: Colors.white,
borderRadius: BorderRadius.circular(50),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: items.map((item) {
var itemIndex = items.indexOf(item);
return GestureDetector(
onTap: () => onTap(itemIndex),
child: _buildNavBarItem(item, pageIndex == itemIndex),
);
}).toList(),
),
),
);
}

