on_off_switcher widget for Flutter project.
For use on_off_switcher widget in your project:
- Add dependency in the pubspec.yaml file
dependencies:
flutter:
sdk: flutter
on_off_switcher:
git:
url: git@github.com:Windmill-Smart-Solutions/FLUTTER-on_off_switcher.git
- Import widget in the dart file:
import 'package:on_off_switcher/on_off_switcher.dart';
import 'package:on_off_switcher/on_off_switcher_state.dart';
-
Make an instance of the widget.
OnOffSwitcher( state: OnOffSwitcherState.switchOn, valueChanged: (state) { if (state == OnOffSwitcherState.switchOn) { print('State is ON'); } else { print('State is OFF'); } }, )
Windmill Smart Solutions 2020 ©