todotxt_reminder/lib/task_item.dart

38 lines
844 B
Dart
Raw Normal View History

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