bouncy_switch 1.0.1 copy "bouncy_switch: ^1.0.1" to clipboard
bouncy_switch: ^1.0.1 copied to clipboard

A lightweight bouncy animated toggle switch for Flutter.

bouncy_switch #

pub package License: MIT

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

Bouncy Switch Demo

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

1
likes
160
points
152
downloads

Publisher

verified publisherdivyanshdev.tech

Weekly Downloads

A lightweight bouncy animated toggle switch for Flutter.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on bouncy_switch