sliding_toggle_switch 1.0.0 copy "sliding_toggle_switch: ^1.0.0" to clipboard
sliding_toggle_switch: ^1.0.0 copied to clipboard

A Sliding toggle switch widget.

Toggle Switch #

A minimal sliding toggle switch widget. It can be customized with desired width, height and colors.

Getting Started #

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  ...
  sliding_toggle_switch: ^1.0.0

Import it:

import 'package:sliding_toggle_switch/sliding_toggle_switch.dart';

Usage Examples #

Basic toggle switch #

// The minimum amount of code to use the switch:
            SlidingToggleSwitch(
              onChange: (value) {
                print(value);
              },
            ),

The default configurations look like this:

Basic toggle switch

Example with all available customizable properties #

    SlidingToggleSwitch(
        width: 100,
        height: 30,
        disabled: true,
        initialValue: true,
        thumbDisabledColor: Colors.grey,
        thumbOnColor: Colors.green.shade600,
        trackDisabledColor: Colors.grey.shade600,
        trackOffColor: Colors.transparent,
        trackOnColor: Colors.transparent,
        thumbOffColor: Colors.grey.shade300,
        borderColor: Colors.black38,
        borderWidth: 3,
        onChange: (value) {
            print(value);
        },
    ),

Various options can look like this:

Basic toggle switch with custom height and font size

3
likes
100
pub points
38%
popularity

Publisher

unverified uploader

A Sliding toggle switch widget.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on sliding_toggle_switch