msh_checkbox 1.0.1 msh_checkbox: ^1.0.1 copied to clipboard
An animated checkbox, inspired by BEMCheckbox for iOS, using an API similar to Flutter's own Checkbox.
import 'package:flutter/material.dart';
import 'package:msh_checkbox/msh_checkbox.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
bool isChecked = false;
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'MSHCheckbox Example',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
appBar: AppBar(title: const Text('MSHCheckbox Example')),
body: Center(
child: MSHCheckbox(
size: 210,
value: isChecked,
checkedColor: Colors.blue,
uncheckedColor: Colors.black12,
onChanged: (selected) {
setState(() {
isChecked = selected;
});
},
),
),
),
);
}
}