Flutter Slide To Act
Today iam going to explain how to create a lightweight flutter plugins that transform normal checkbox input into animated toggle switches.
This Repository is available on GitHub and you can download source code free of cost.This plugin created by @Salvatore Giordano and he was inspired from Android Slide To Act Repo.
The primary action is similar to Slide to Unlock .
Installation
Add following to your package’s pubspec.yaml file:
Check following url to get latest version on Pub and replace below section
dependencies:
slide_to_act: any # or the latest version on Pub
After save the slide_to_act packages are automatically downloaded and included into your project.
Import
The next step import this library to your dart file. for that you can use following syntax .
import 'package:slide_to_act/slide_to_act.dart';
Sample Code
Refer the following sample code for to generate Slide to Act plugin
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: HomePage());
}
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ListView(
children: <Widget>[
Builder(
builder: (context) {
return Padding(
padding: const EdgeInsets.all(10.0),
child: SlideAction(),
);
},
)
],
),
));
}
}
An example app showing all the features is available in this repo in the folder example
.
Or just go to this link to see it compiled for the web https://imtoori.dev/flutter-slide-to-act/#/
Demo

