reusable_tab_bar 0.0.1 copy "reusable_tab_bar: ^0.0.1" to clipboard
reusable_tab_bar: ^0.0.1 copied to clipboard

A Flutter package for reusable and customizable tab bars with state management support using ChangeNotifier and Bloc. Includes flexible options for app bar, tab styling, and more.

Reusable Tab Bar #

A flexible, customizable Flutter widget package that makes it easy to build advanced TabBar interfaces with Bloc, Cubit, and ChangeNotifier support.

Features #

  • Easily create tabbed interfaces with custom tab headers and tab screens.
  • Built-in support for ChangeNotifier and Bloc/Cubit state management.
  • Customize AppBar titles, colors, heights, and actions.
  • Add floating action buttons (FABs) specific to each tab.
  • Support for Drawer and extra bottom widgets below tabs.
  • Lightweight and efficient tab state management with automatic index tracking.

Getting Started #

Installation #

Add to your pubspec.yaml:

reusable_tab_bar: latest

Then run:

flutter pub get

Usage #

import 'package:reusable_tab_bar/reusable_tab_bar.dart';

// Inside your widget tree
AppTabBar(
  tabScreens: [
    ScreenOne(),
    ScreenTwo(),
    ScreenThree(),
  ],
  tabHeaders: [
    Tab(text: 'One'),
    Tab(text: 'Two'),
    Tab(text: 'Three'),
  ],
  titleTxt: 'My Tabbed App',
  centerTitle: true,
  drawer: MyDrawer(),
  fabButtons: [
    FloatingActionButton(onPressed: () {}),
    FloatingActionButton(onPressed: () {}),
    FloatingActionButton(onPressed: () {}),
  ],
)

Or use with a selector-style button header:

AppTabBarWithSelectorButton(
  tabBarViews: [
    ScreenOne(),
    ScreenTwo(),
    ScreenThree(),
  ],
  selectorButtons: [
    ElevatedButton(onPressed: () {}, child: Text('One')),
    ElevatedButton(onPressed: () {}, child: Text('Two')),
    ElevatedButton(onPressed: () {}, child: Text('Three')),
  ],
)

State Management #

  • TapBarProvider (with ChangeNotifier) for basic reactive tab changes.
  • TabBarCubit and TabBarState (with Bloc) for more advanced state handling.

Tab changes automatically sync with UI elements using these providers.

Customization Options #

Property Description
tabScreens List of widgets for each tab's content
tabHeaders List of widgets for each tab's header
fabButtons Floating action buttons specific to each tab
titleTxt, titleWidget Title for the AppBar
centerTitle Center the title text
backgroundColor Background color of AppBar
indicatorColor, indicatorWeight Tab indicator customization
selectedLabelColor, unselectedLabelColor Label color customization
drawer Add a navigation drawer
actionsList Add AppBar actions
bottomWidget, bottomTitleTxt Optional bottom widgets below tabs

Example #

For a complete example, check the /example folder.

Roadmap #

  • ❌ Dark mode support.
  • ❌ More animation options.
  • ❌ Custom tab controller injection.

Contributing #

Contributions are welcome! Please open issues or submit pull requests.

License #

MIT License


0
likes
140
points
196
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for reusable and customizable tab bars with state management support using ChangeNotifier and Bloc. Includes flexible options for app bar, tab styling, and more.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

app_style, bloc, equatable, flutter, flutter_bloc

More

Packages that depend on reusable_tab_bar