apptomate_custom_checkbox 0.0.2
apptomate_custom_checkbox: ^0.0.2 copied to clipboard
A customizable checkbox component with smooth animations and flexible styling options.
example/lib/main.dart
import 'package:apptomate_custom_checkbox/apptomate_custom_checkbox.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
_CustomCheckboxExampleState createState() => _CustomCheckboxExampleState();
}
class _CustomCheckboxExampleState extends State<MyHomePage> {
bool isChecked = false;
bool isChecked2 = false;
bool isChecked3 = false;
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomCheckbox(
value: isChecked,
padding: EdgeInsets.only(left: 2),
onChanged: (v) => setState(() => isChecked = v),
labelWidget: Row(
children: [
Icon(Icons.privacy_tip, size: 18),
SizedBox(width: 8),
Text("Privacy Policy"),
],
),
),
CustomCheckbox(
value: isChecked3,
onChanged: (newValue) {
setState(() {
isChecked3 = newValue;
});
},
labelWidget:Text("Accept Terms&Conditions") ,
activeColor: Colors.blueAccent,
borderRadius: 8,
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 15),
),
CustomCheckbox(
value: isChecked2,
onChanged: (val) => setState(() => isChecked2 = val),
padding: EdgeInsets.zero,
labelWidget: RichText(
text: TextSpan(
text: "I agree to the ",
style: TextStyle(color: Colors.black),
children: [
TextSpan(
text: "Terms of Service",
style: TextStyle(
color: Colors.blue,
decoration: TextDecoration.underline,
),
recognizer: TapGestureRecognizer()..onTap = () => null,
),
],
),
),
)
],
),
),
),
);
}
}