Skip to content
pubscout

flutter_toggle_tab

2.0.0, released 2 months ago by lazycatlabs.com

A customisable toggle tab widget for Flutter with animated selection and adaptive widths.

WASM-readyUses material_ui
$ flutter pub add flutter_toggle_tab
Source repository

What it does

Provides a toggle tab widget supporting text, icons, and counter widgets. It features animated indicators, gradients, custom margins, and adaptive widths.

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

Use it when

  • You need a segmented control or toggle tab widget to switch between different views.
  • You require customizable tab indicators with animations, icons, or badges.

Skip it when

  • You need a complex tab navigation system with page views or multiple full screens (use Flutter's default TabBar instead).
  • Your application is using legacy material imports and hasn't upgraded to Flutter 3.47 and the standalone material_ui package.

Strengths

  • Supports adaptive widths, icons, badges, and gradient backgrounds.
  • Includes animated selection indicators with customizable duration and curves.
  • Uses local ValueNotifier state management for optimized rebuilding.

Weaknesses

  • Requires Flutter 3.47+ and Dart 3.13+, which may be too new for older projects.
  • Depends on the standalone material_ui package.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1

Add flutter_toggle_tab and material_ui to pubspec.yaml and ensure Flutter 3.47+ requirements are met.

ValueListenableBuilder<int>(
  valueListenable: selectedIndex,
  builder: (context, currentIndex, _) => FlutterToggleTab(
    width: 90,
    borderRadius: 30,
    dataTabs: [
      DataTab(title: 'Popular'),
      DataTab(title: 'Recent'),
    ],
    selectedIndex: currentIndex,
    selectedLabelIndex: (index) => selectedIndex.value = index,
  ),
)

Alternatives

Packages that do the same job and could replace flutter_toggle_tab.

Works with

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