Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter: Tabbar vs BottomNavigationBar

Tags:

flutter

dart

I'm trying to figure out the best way for bottom navigation with swipe enabled. I found two promising widgets: Tabbar (with TabBarView) and BottomNavigationBar. The tabbar is easy to use and has a controller property which allows swiping between tabs easily. But there is no way to set the backgroundcolor (or am I wrong?). The bottomnavigationbar allows customizability outside of the appBar but doesn't work with controllers. So how would I work with the bottomnavigationbar? Should I manually show and hide the page/widget?

like image 665
Bram Vanbilsen Avatar asked May 26 '17 18:05

Bram Vanbilsen


1 Answers

Setting the background color on a TabBar can be done by wrapping it in a Material of the color you want. It's unusual to have one of these at the bottom of the screen though.

You could use the BottomNavigationBar's onTap to trigger page changes in a PageView if you want the views to be swipeable.

like image 87
Collin Jackson Avatar answered Nov 13 '22 10:11

Collin Jackson