lite_rolling_switch 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 94

lite_rolling_switch #

Full customable rolling switch widget for flutter apps based on Pedro Massango's 'crazy-switch' widget

About #

Custom Switch button with attractive animation, made to allow you to customize colors, icons and other cosmetic content. Manage the widget states in the same way you do with the classical material's switch widget.

NOTE: Currently, you cannot directly change the widget width and height properties. This feature will be available soon.

Previews #

Image preview

Image preview 2

Basic Implementation #

import 'package:lite_rolling_switch/lite_rolling_switch.dart';

    //initial value
    value: true,
    textOn: 'disponible',
    textOff: 'ocupado',
    colorOn: Colors.greenAccent[700],
    colorOff: Colors.redAccent[700],
    iconOn: Icons.done,
    iconOff: Icons.remove_circle_outline,
    textSize: 16.0,
    onChanged: (bool state) {
      //Use it to manage the different states
      print('Current State of SWITCH IS: $state');

Other #

[0.0.1] - Initial Release: October 31th, 2019. #

  • Widget initial release with basic color and other cosmetic customation.

[0.1.1] - Official Release: November 3rd, 2019. #

  • Better documentation.
  • Bugs fixed and new hints for widget arguments.
  • Argument onMain is no longer exists.
  • Added Examples and new ilustrative content for readme.


import 'package:flutter/material.dart';
import 'package:lite_rolling_switch/lite_rolling_switch.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) => MaterialApp(
        title: 'Examples',
        home: MyHomePage(),

class MyHomePage extends StatefulWidget {
    Key key,
  }) : super(key: key);

  _MyHomePageState createState() => _MyHomePageState();

class _MyHomePageState extends State<MyHomePage> {
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Example'),
      body: Center(
        child: Column(
          children: <Widget>[
            //By default
              value: false,
              onChanged: (bool state) {
                print('turned ${(state) ? 'on' : 'off'}');

              padding: EdgeInsets.only(top: 20),
              child: LiteRollingSwitch(
                value: true,
                textOn: 'active',
                textOff: 'inactive',
                colorOn: Colors.deepOrange,
                colorOff: Colors.blueGrey,
                iconOn: Icons.lightbulb_outline,
                iconOff: Icons.power_settings_new,
                onChanged: (bool state) {
                  print('turned ${(state) ? 'on' : 'off'}');

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  lite_rolling_switch: ^0.1.1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:lite_rolling_switch/lite_rolling_switch.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Apr 6, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies