Beautiful Custom Switch package created with Flutter

Overview

custom_switch

Beautiful Custom Switch package created with Flutter.

Say Thanks!

The source code is 100% Dart, and everything resides in the /lib folder.

Show some ❤️ and star the repo to support the project

GitHub followers Twitter Follow

Open Source Love

💻 Installation

In the dependencies: section of your pubspec.yaml, add the following line:

custom_switch: 
   

Import in your project:

import 'package:custom_switch/custom_switch.dart';

Basic Usage

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('Custom Switch Example'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            CustomSwitch(
              activeColor: Colors.pinkAccent,
              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
            ),)
          ],
        ),
      ),
    );
  }
}

Screenshots

custom_switch

👨 Developed By

Mohak Gupta

👍 How to Contribute

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

📃 License

Copyright (c) 2019 Mohak Gupta

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

You might also like...

best flutter / dart practices + Custom Painter + Sliver App Bar + Custom Scrollview

best flutter / dart practices + Custom Painter + Sliver App Bar + Custom Scrollview

Weekly Budget Flutter App A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get yo

Oct 21, 2021

A customizable carousel slider widget in Flutter which supports inifinte scrolling, auto scrolling, custom child widget, custom animations and built-in indicators.

A customizable carousel slider widget in Flutter which supports inifinte scrolling, auto scrolling, custom child widget, custom animations and built-in indicators.

flutter_carousel_widget A customizable carousel slider widget in Flutter. Features Infinite Scroll Custom Child Widget Auto Play Horizontal and Vertic

Nov 26, 2022

FT-Custom-Widget - A Custom Widget Built With Flutter

FT-Custom-Widget - A Custom Widget Built With Flutter

Custom Widget Watch it on YouTube Product Screen Sample when you implement compl

Mar 29, 2022

A customizable carousel slider for Flutter. Supports infinite sliding, custom indicators, and custom animations with many pre-built indicators and animations.

A customizable carousel slider for Flutter. Supports infinite sliding, custom indicators, and custom animations with many pre-built indicators and animations.

Flutter Carousel Slider A customizable carousel slider for flutter Screenshots Installing dependencies: flutter_carousel_slider: ^1.0.8 Demo Demo a

Nov 6, 2022

Flutter custom carousel slider - A carousel slider widget,support custom decoration suitable for news and blog

Flutter custom carousel slider - A carousel slider widget,support custom decoration suitable for news and blog

flutter_custom_carousel_slider A carousel slider Flutter widget, supports custom

Dec 29, 2022

Arisonboardingscreen - Create your custom and beautiful onboarding screens easily with Flutter

Arisonboardingscreen - Create your custom and beautiful onboarding screens easily with Flutter

Flutter Tutorial - Onboarding UI Screen Create your custom and beautiful onboard

Oct 30, 2022

A beautiful mod installer for minecraft supporting custom repositories and more.

A beautiful mod installer for minecraft supporting custom repositories and more.

argoninstaller ⚠️ ⚠️ THIS PROJECT IS STILL IN EARLY DEVELOPMENT ⚠️ ⚠️ A beautiful mod installer for minecraft supporting custom repositories and more.

Aug 28, 2022

Car-Rental-App-UI-Flutter - Beautiful Car Rental App UI with support for dark mode. Created by Martin Gogołowicz.

Car-Rental-App-UI-Flutter - Beautiful Car Rental App UI with support for dark mode. Created by Martin Gogołowicz.

Flutter Car Rental App UI with darkmode support Flutter 2.8.1 Null Safety Beautiful Car Rental App UI with support for dark mode. Created by Martin Go

Dec 28, 2022

Beautiful Lottery App created in Flutter using Simple coding + State_full Widgets.

lottery_app A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if t

Sep 7, 2022
Comments
  • More customizations

    More customizations

    I've added more customization options to the Custom Switch, this is the list: inactiveColor, activeText, inactiveText, activeTextColor, inactiveTextColor. The customizations that I added have got default values so users are able to continue using existing code based on your repo but they have the ability in future to customize deeply your switch.

    opened by polilluminato 1
  • How to reset the state?

    How to reset the state?

    Hi-

    When user tab to turn on, my app opens the Confirmation dialog, if user tab to Cancel button, the CustomSwitch should be turned off again but it still turned on. Is there a "Before Switch" function or the way that I can turn it off after user tab Cancel button? Thanks.

    opened by cuongdl 0
Owner
Mohak Gupta
Intern @Zomato | Google Certified Associate Android Developer | Flutter Developer | GCI 2019 Mentor @systers
Mohak Gupta
An easy to implement custom switch created for Flutter.

flutter_switch An easy to implement custom switch created for Flutter. Give it a custom height and width, border for the switch and toggle, border rad

Nickr 66 Dec 6, 2022
A beautiful switch made with Flutter

Crazy Switch Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this is your first Flut

Pedro Massango 50 Nov 20, 2022
Flutter package that provides you custom clippers to help you achieve various custom shapes.

flutter_custom_clippers Flutter package that provides you custom clippers to help you achieve various custom shapes. Usage To use this plugin, add flu

Damodar Lohani 291 Dec 23, 2022
Flutter Xlive Switch

xlive_switch A Xlive Switcher plugin for Flutter Getting Started This plugin is based on Oleg Frolov's animation design which I found on Dribbble: htt

Châu Minh Phúc 15 Nov 4, 2022
Daynightswitch - A day night switch widget for Flutter.

DayNightSwitch A day night switch widget for Flutter. Installation Add to pubspec.yaml. dependencies: day_night_switch: Usage To use plugin, just i

Divyanshu Bhargava 103 Oct 25, 2022
Building a simple Flutter app * Switch Theme * for understanding the BLoC State Management including: Cubit Communications with StreamSubscription & Managing Route.

Building a simple Flutter app * Switch Theme * for understanding the BLoC State Management including: Cubit Communications with StreamSubscription & Managing Route.

TAD 1 Oct 3, 2022
An interesting and practical switch component.

FSwitch An interesting and practical switch component. Supports setting tips, slider decorations, shadows, and good interaction. Author:Newton(coorchi

Fliggy Mobile 81 Dec 13, 2022
Declaratively switch child widgets based on the current `Router` location.

Features Declaratively switch child widgets based on the current Router location. class SideBar extends StatelessWidget { Widget build(_){ re

gskinner team 7 Dec 12, 2022
A smart switch for you.

Features A smart switch for you.

Narendra Bhatt 2 Aug 26, 2022
A new flutter package project which contains lots of beautiful alert dialog that will help you lot to create beautiful awesome alert box very quickly and easily.

A new flutter package project which contains lots of beautiful alert dialog that will help you lot to create beautiful awesome alert box very quickly and easily.

Karan Soni 8 Jan 8, 2022