todotxt_reminder/lib/task_item.dart

36 lines
726 B
Dart

import 'package:flutter/material.dart';
class TaskItem extends StatefulWidget {
final bool? done;
const TaskItem({super.key, this.done});
@override
State<TaskItem> createState() => _TaskItemState();
}
class _TaskItemState extends State<TaskItem>{
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(0.0),
child: _done == null ? null : Checkbox(value: _done, onChanged: (newState) => setState(() {
_done = newState!;
})),
);
}
}