Search packages, repositories and app categories

animated_segmented_tab_control cover
Package detailsv2.2.0

animated_segmented_tab_control

A customizable segmented control that can be used with a TabView.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
4.1K
Likes
100
Pub points
160

Install package

flutter pub add animated_segmented_tab_control

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A customizable animated segmented control designed to work seamlessly with TabView in Flutter applications. It provides smooth transitions between segments, supports various styling options, and enhances user interaction with dynamic visual feedback. Ideal for apps requiring intuitive tab navigation with a modern aesthetic. The package is compatible across all major platforms including Android, iOS, Web, macOS, Windows, and Linux.

Use cases

  • Interactive tab navigation
  • Dynamic UI transitions
  • Customizable tab interfaces
  • Cross-platform tab controls
  • Enhanced user experience in dashboards
  • Form section switching

Key features

  • Smooth animated transitions
  • Highly customizable appearance
  • Built-in support for TabView
  • Responsive design across platforms
  • Easy integration with existing Flutter projects
  • Supports both horizontal and vertical layouts

Suitable for

  • Developers building cross-platform apps
  • Designers seeking modern UI components
  • Apps with multiple content sections
  • Projects requiring interactive tab experiences
  • Teams prioritizing consistent UX across devices

Considerations

  • May require additional styling for complex themes
  • Performance impact with large numbers of segments
  • Limited built-in accessibility features
  • Dependent on external TabView implementation
  • Not optimized for extremely high-frequency updates

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

A customizable segment tab control. Can be used with or without TabView.

Made in lanars.com.

pub package

Features

The package provides an advanced segmented control widget based on the TabController.

Usage

The package contains a SegmentedTabControl widget that requires a SegmentTab list.

SegmentedTabControl(
  tabs: [
    SegmentTab(
      label: 'Home',
    ),
  ],
)

SegmentedTabControl also requires a TabController. You can provide it with a DefaultTabController or instantiate a TabController instead.

DefaultTabController(
  length: 2,
  child: SegmentedTabControl(
    tabs: [
      SegmentTab(
        label: 'Home',
      ),
      SegmentTab(
        label: 'Account',
      ),
    ],
  ),
)

You can style the whole widget, an individual tab, or both. A value on the currently selected SegmentTab overrides the corresponding value on SegmentedTabControl.

SegmentedTabControl(
  barDecoration: BoxDecoration(
    color: Colors.grey.shade300,
    borderRadius: BorderRadius.circular(10),
  ),
  indicatorDecoration: BoxDecoration(
    color: Colors.orange.shade200,
    borderRadius: BorderRadius.circular(10),
  ),
  tabTextColor: Colors.black45,
  selectedTabTextColor: Colors.white,
  tabs: [
    SegmentTab(
      label: 'ACCOUNT',
      color: Colors.red.shade200,
    ),
    SegmentTab(
      label: 'HOME',
      backgroundColor: Colors.blue.shade100,
      selectedTextColor: Colors.black45,
      textColor: Colors.black26,
    ),
    const SegmentTab(label: 'NEW'),
  ],
)

Note that the text colors are read from the selected tab and applied to the whole bar, so textColor and selectedTextColor set the bar's label colors while that tab is selected rather than coloring only that one tab.

Change tracking logic is identical to TabBar logic.

DefaultTabController.of(context).index

or

_controller.index

Сustom tab content

Use SegmentTab.labelBuilder to show any widget like an icon.

The selected-tab highlight is produced by painting the tab row twice and clipping the upper copy to the indicator, so the builder is called once per layer and receives the color of the layer it is painting. Plain Icon and Text children inherit that color. Use color for anything that does not inherit it, such as a border or an SVG:

SegmentTab(
  label: 'NEW',
  labelBuilder: (context, color) => Container(
    padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
    decoration: BoxDecoration(
      border: Border.all(color: color),
      borderRadius: BorderRadius.circular(20),
    ),
    child: Text('NEW'),
  ),
)

Interactive children are not supported.

Additional information

If you have any ideas or are running into a bug, please submit an issue on github page: https://github.com/LanarsInc/animated-segmented-tab-control/issues

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package

No data available yet.