import 'package:flutter/material.dart'; class TaskItem extends StatefulWidget { final bool? done; const TaskItem({super.key, this.done}); @override State createState() => _TaskItemState(); } class _TaskItemState extends State{ bool? _done; @override void initState() { super.initState(); _done = widget.done; } @override Widget build(BuildContext context) { return Container( alignment: Alignment.center, width: 60.0, height: 60.0, color: Colors.white, margin: const EdgeInsets.all(4.0), child: _done == null ? null : Checkbox(value: _done, onChanged: (newState) => setState(() { _done = newState!; })), ); } }