bouncy_switch
A lightweight bouncy animated toggle switch for Flutter with smooth spring animations.

Features
- ✨ Smooth spring animation with bouncy effect
- 🎨 Customizable colors for on/off states
- 📱 Supports all platforms (iOS, Android, Web, Windows, macOS, Linux)
- 🪶 Lightweight with no external dependencies
- 🔧 Simple and intuitive API
Installation
Add bouncy_switch to your pubspec.yaml:
dependencies:
bouncy_switch: ^1.0.0
Then run:
flutter pub get
Usage
Basic Usage
import 'package:bouncy_switch/bouncy_switch.dart';
bool _value = false;
BouncySwitch(
value: _value,
onChanged: (value) {
setState(() {
_value = value;
});
},
)
Custom Colors
BouncySwitch(
value: _value,
activeColor: Colors.green,
inactiveColor: Colors.grey,
thumbColor: Colors.white,
onChanged: (value) {
setState(() {
_value = value;
});
},
)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
value |
bool |
required | The current state of the switch |
onChanged |
ValueChanged<bool> |
required | Callback when the switch is toggled |
activeColor |
Color? |
Colors.blue |
Background color when switch is on |
inactiveColor |
Color? |
Colors.grey |
Background color when switch is off |
thumbColor |
Color? |
Colors.white |
Color of the thumb/knob |
Example
Check out the example directory for a complete sample app.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
Divyansh Vishwakarma
- GitHub: @DivyanshVish