Search code examples
flutterflutter-layout

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


Solution

    • TabBarView is the widget used when each tab has different functionalty. TabBarView works with a TabController. For example, WhatsApp has three tabs with different functionality, like Chats, Status and Calls.

    • PageView works with a PageController. You can use it for a Slider, or for creating a carousel.

    If each page has a different UI and functionality, use a TabBarView. If they have the same UI and functionalty and only page data differs, then you can go with a PageView.

    TabBarView for:

    enter image description here

    PageView for:

    enter image description here