import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:manager_app/Components/color_picker.dart'; import '../constants.dart'; class CheckInputContainer extends StatefulWidget { final bool isChecked; final IconData icon; final String label; final ValueChanged onChanged; const CheckInputContainer({ Key key, this.isChecked, this.icon, this.label, this.onChanged, }) : super(key: key); @override _CheckInputContainerState createState() => _CheckInputContainerState(); } class _CheckInputContainerState extends State { bool isChecked; @override void initState() { setState(() { isChecked = widget.isChecked; }); super.initState(); } @override Widget build(BuildContext context) { return Container( child: Row( children: [ Align( alignment: AlignmentDirectional.centerStart, child: Row( children: [ if(widget.icon != null) Padding( padding: const EdgeInsets.only(right: 8.0), child: Icon( widget.icon, color: kPrimaryColor, size: 25.0, ), ), if(widget.label != null) Text(widget.label, style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300)), ], ) ), Padding( padding: const EdgeInsets.all(10.0), child: Container( width: 50, height: 50, child: Checkbox( shape: CircleBorder(), value: isChecked, checkColor: Colors.white, activeColor: kPrimaryColor, onChanged: (bool value) { setState(() { isChecked = value; }); widget.onChanged(value); }, ), ), ), ], ), ); } }