Skip to content
pubscout

contained_tab_bar_view

0.8.0, released 5 years ago by scipack.dev

Encapsulates TabController, TabBar and TabBarView into a single customizable Widget.

WASM-ready
$ flutter pub add contained_tab_bar_view
Source repository

What it does

Combines a TabController, TabBar, and TabBarView into one easy-to-use widget. It allows you to customize tab bar positions (top, bottom, left, right), alignment, appearance, and physics without manually managing the internal tab controller ecosystem.

AI-written summary of version 0.8.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to combine tabs and views into a single container-friendly widget without boilerplate.
  • You need custom tab bar positions like left, right, or bottom relative to the views.
  • You need to programmatically change tabs using a GlobalKey.

Skip it when

  • You require complex custom Scaffold-level nested navigation where standard DefaultTabController is preferred.

Strengths

  • Simplifies working with TabBar and TabBarView by encapsulating them into one widget.
  • Supports flexible tab bar positioning (top, bottom, left, right) and alignment.
  • Exposes state methods like animateTo(), next(), and previous() for external control.

Weaknesses

  • Limited to tab-based interfaces and associated properties.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1
Container(
  width: 200,
  height: 300,
  child: ContainedTabBarView(
    tabs: [
      Text('First'),
      Text('Second'),
    ],
    views: [
      Container(color: Colors.red),
      Container(color: Colors.green)
    ],
    onChange: (index) => print(index),
  ),
)

Alternatives

Packages that do the same job and could replace contained_tab_bar_view.

Works with

Packages commonly used together with contained_tab_bar_view: ones it builds on, ones built on it, and its own family.