e_tab_bar 0.0.1

SDKflutter
Platformandroidioswindowslinuxmacosweb

A customizable TabBar widget for Flutter that supports custom indicators using any Widget type. Easily create scrollable tabs with icon support and smooth page transitions.

ETabBar

A customizable TabBar widget for Flutter that supports custom indicators using any Widget type. Easily create scrollable tabs with icon support and smooth page transitions.

Features

  • Custom Widget Indicators: Use any Widget as your tab indicator
  • Scrollable Tabs: Support for both fixed and scrollable tab layouts
  • Page Integration: Seamless integration with PageView for smooth transitions
  • Icon Support: Easily create tabs with icons and text
  • Flexible Customization: Control alignment, direction, and appearance

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  e_tab_bar: ^0.0.1

Then run:

flutter pub get

Usage

Basic Example

import 'package:e_tab_bar/e_tab_bar.dart';
import 'package:flutter/material.dart';

// Create a controller
final tabController = ETabBarCntlr();

// Create the tab bar
ETabBar(
  cntlr: tabController,
  children: [
    Container(
      width: 50,
      height: 40,
      alignment: Alignment.center,
      child: Text('Tab 1'),
    ),
    Container(
      width: 50,
      height: 40,
      alignment: Alignment.center,
      child: Text('Tab 2'),
    ),
    Container(
      width: 50,
      height: 40,
      alignment: Alignment.center,
      child: Text('Tab 3'),
    ),
  ],
)

With PageView Integration

// Controllers
final tabController = ETabBarCntlr();
final pageController = PageController();

// Tab Bar
ETabBar(
  cntlr: tabController,
  onTap: (index) => tabController.animateChangePage(pageController, index),
  children: [
    // Your tab widgets
  ],
),

// Page View
PageView(
  controller: pageController,
  onPageChanged: tabController.onPageChanged,
  children: [
    // Your page content
  ],
)

Custom Indicator

ETabBar(
  cntlr: tabController,
  indicator: Container(
    height: 4,
    decoration: BoxDecoration(
      color: Colors.red,
      borderRadius: BorderRadius.circular(2),
    ),
  ),
  children: [
    // Your tab widgets
  ],
)

Parameters

ParameterTypeDescription
childrenList<Widget>The tab widgets to display
cntlrETabBarCntlr?Controller for the tab bar
indicatorWidget?Custom indicator widget
isScrollableboolWhether tabs can scroll horizontally
mainAxisSizeMainAxisSizeHow much space to occupy in the main axis
crossAxisAlignmentCrossAxisAlignmentHow to align children in the cross axis
directionAxisThe direction of the tab bar (horizontal or vertical)
onTapValueChanged<int>?Callback when a tab is tapped

License

This project is licensed under the MIT License - see the LICENSE file for details.