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.
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.
- flutter_advanced_drawer
Customizable advanced drawer widget for Flutter
77Compare - sliding_switch
A simple customizable switch widget with sliding animation and selection state support.
47Compare - flutter_toggle_tab
A customisable toggle tab widget for Flutter with animated selection and adaptive widths.
80Compare - app_badge_plus
Flutter plugin to set numeric badges on app icons for iOS, Android, and macOS
84Compare