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, decoration: BoxDecoration(border: Border( left: BorderSide(color: Theme.of(context).colorScheme.background, width: 1) ),), margin: const EdgeInsets.all(0.0), child: _done == null ? null : Checkbox(value: _done, onChanged: (newState) => setState(() { _done = newState!; })), ); } }