custom_switch
Beautiful Custom Switch package created with Flutter.
The source code is 100% Dart, and everything resides in the /lib folder.
Show some and star the repo to support the project
Installation
In the dependencies:
section of your pubspec.yaml
, add the following line:
custom_switch: <latest_version>
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
Contribute on custom switch package on GitHub
Check out implementation guide on pub.dev
https://pub.dev/packages/custom_switch
Provides the list of the opensource Flutter apps collection with GitHub repository.