customtoggleswitch 1.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new56

CustomToggleSwitch #

A new Flutter package customtoggleswitch is used to toggle a setting between on/off which is true/false respectively Created by suryadevsingh.

Demo #

1. Depend on it #

dependencies:
  customtoggleswitch: any

2. Install it #

$ flutter pub get

3. Import it #

import 'package:customtoggleswitch/customtoggleswitch.dart';

Contributing #

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

[1.0.0] - TODO: Add release date [ 16 May 2020]. #

[1.0.1] - Bug fixes . #

[1.0.2] - Updated example. #

[1.0.3] - Updated License. #

[1.0.4] - Updated README.md. #

[1.0.5] - Updated README.md. #

[1.0.5+1] - Updated README.md. #

[1.0.5+2] - Updated README.md and Example. #

[1.0.5+3] - Updated README.md. #

[1.0.5+4] - Updated README.md. #

[1.0.5+5] - Updated README.md. #

[1.0.5+6] - Updated README.md. #

[1.0.5+7] - Updated README.md. #

[1.1.0] - Updated README.md. #

  • TODO: Describe initial release.

Example/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
          primarySwatch: Colors.deepOrange
      ),
      home: HomeScreen(),
    );
  }
}


class HomeScreen extends StatefulWidget {
  @override
  _HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {

  bool status = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(' CustomToggleSwitch Example'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            CustomToggleSwitch(
              activeText: "On",
              inactiveText: "Off",
              inactiveColor: Colors.red[300],
              activeTextColor: Colors.white,
              inactiveTextColor: Colors.white,
              activeColor: Colors.green[300],
              value: status,
              onChanged: (value) {
                print("VALUE : $value");
                setState(() {
                  status = value;
                });
              },
            ),
            SizedBox(height: 12.0,),
            Text('Value : $status', style: TextStyle(
                color: Colors.black,
                fontSize: 20.0
            ),)
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  customtoggleswitch: ^1.1.0

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:customtoggleswitch/customtoggleswitch.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
11
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
56
Learn more about scoring.

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

  • Dart: 2.8.1
  • pana: 0.13.8-dev
  • Flutter: 1.17.0

Health suggestions

Format lib/customtoggleswitch.dart.

Run flutter format to format lib/customtoggleswitch.dart.

Dependencies

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