added checkbox to toggle if task is completed
This commit is contained in:
@@ -40,7 +40,13 @@ class _TaskOverviewPageState extends State<TaskOverviewPage> {
|
|||||||
return ListTile(
|
return ListTile(
|
||||||
key: Key(task.id),
|
key: Key(task.id),
|
||||||
title: Text(task.title),
|
title: Text(task.title),
|
||||||
subtitle: Text(task.description),
|
subtitle: task.description.isNotEmpty ? Text(task.description) : null,
|
||||||
|
trailing: Checkbox(
|
||||||
|
value: task.isCompleted,
|
||||||
|
onChanged: (isCompleted) => context
|
||||||
|
.controller<TaskController>()
|
||||||
|
.saveTask(task.copyWith(isCompleted: isCompleted)),
|
||||||
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final result = await onTaskTapped(task);
|
final result = await onTaskTapped(task);
|
||||||
if (result != null && context.mounted) {
|
if (result != null && context.mounted) {
|
||||||
|
|||||||
Reference in New Issue
Block a user