| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- import 'package:flutter/material.dart';
- class RoundCheckBox extends StatefulWidget {
- bool value = false;
- final double size;
- final Color activeColor;
- final Color defaultColor;
- final Function(bool) onChanged;
- RoundCheckBox({Key key, @required this.value, this.onChanged, this.size,
- this.activeColor = Colors.white, this.defaultColor = Colors.white }) : super(key: key);
- @override
- _RoundCheckBoxState createState() => _RoundCheckBoxState();
- }
- class _RoundCheckBoxState extends State<RoundCheckBox> {
- @override
- Widget build(BuildContext context) {
- return Center(
- child: GestureDetector(
- onTap: () {
- widget.value = !widget.value;
- widget.onChanged(widget.value);
- },
- child: Padding(
- padding: const EdgeInsets.all(10.0),
- child: widget.value ? Icon(
- Icons.check_circle,
- size: widget.size,
- color: widget.activeColor,
- ) : Icon(
- Icons.panorama_fish_eye,
- size: widget.size,
- color: widget.defaultColor,
- ),
- )),
- );
- }
- }
|