Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between `TabBarView` and `PageView` in Flutter?

What is the difference between TabBarView and PageView in Flutter?

I want to implement like this. And I know both can do.

enter image description here

From flutter-examples

like image 615
sos418 Avatar asked Jun 15 '18 09:06

sos418


People also ask

What is TabBarView Flutter?

TabBar is used to create the tabs, while TabBarView is used to define the content of each tab. Flutter already handles how to switch between tabs, which makes it easier for us. In addition, Flutter also makes it possible to customize the style and behavior of the tab layout. Below are the explanations and examples.

How do you implement pageviews in Flutter?

Scroll down to the end to get the full code demo. A PageView widget allows the user to swipe/transition between different screens in your app. All you need to set it up are a PageViewController and a PageView. You can use PageController to control which page is visible in the view.

How do you use tab controller on Flutter?

To create a tab in it, create a tab list and create an object of its TabController. TabController _tabController; Initalize the TabController inside the initState() method and also override it in the dispose() method.


1 Answers

  • TabBarView is the widget used to each page with different functionalty that are split with tab. TabBarView link with TabController. i.e Like WhatsApp have tabs with three different functionality page like Chats, Status, Calls.

  • PageView is link with PageController. You can use for Slider, carousel purpose.

Each page have different UI and functionality use TabBarView. If same ui and functionalty all page data only differ then you can go with PageView

TabBarView for

enter image description here

PageView for

enter image description here

like image 64
Magesh Pandian Avatar answered Oct 04 '22 06:10

Magesh Pandian