import 'package:flutter/material.dart';

class RoundCheckBox extends StatefulWidget {
  final bool value;
  final double size;
  final Color activeColor;
  final Color defaultColor;
  final Function(bool) onChanged;

  RoundCheckBox({Key key, this.value = false, this.onChanged, this.size,
    this.activeColor = Colors.white, this.defaultColor = Colors.white }) : super(key: key);

  @override
  _RoundCheckBoxState createState() => _RoundCheckBoxState();
}

class _RoundCheckBoxState extends State<RoundCheckBox> {
  bool value = false;
  _RoundCheckBoxState() {
    value = widget.value;
  }

  @override
  Widget build(BuildContext context) {
    return Center(
      child: GestureDetector(
          onTap: () {
            value = !value;
            widget.onChanged(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,
            ),
          )),
    );
  }
}