Skip to content
pubscout

toggle_switch

2.3.0, released 3 years ago by pramod.dev

A customizable toggle switch widget that maintains selection state and supports icons, text, and custom widgets.

Flutter FavoriteWASM-ready
$ flutter pub add toggle_switch
Source repository

What it does

Provides a customizable toggle switch widget for Flutter applications. It supports multiple switches, icons, custom text styles, gradients, vertical layouts, and state maintenance out-of-the-box.

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

Use it when

  • You need a multi-state or binary toggle switch UI component.
  • You want to customize colors, icons, borders, and animations for a switch.
  • You need to handle selection state changes with an optional cancellation callback.

Skip it when

  • You are looking for a standard Material Switch widget (use Flutter's built-in Switch instead).
  • You need complex form validation integration (though it can be used inside forms).

Strengths

  • Highly customizable with icons, text, custom widgets, and gradients.
  • Supports vertical orientation and RTL text directions.
  • Maintains selection state easily with callbacks and cancel toggle support.

Weaknesses

  • Limited to toggle switch UI use cases.
  • No built-in form field controller integration documented.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
ToggleSwitch(
  initialLabelIndex: 0,
  totalSwitches: 3,
  labels: ['America', 'Canada', 'Mexico'],
  onToggle: (index) {
    print('switched to: $index');
  },
)

Alternatives

Packages that do the same job and could replace toggle_switch.