implemeted way to delete entries

This commit is contained in:
SomnusVeritas
2023-11-15 14:42:03 +01:00
parent 36aa01fdde
commit 81c1c67b0b

View File

@@ -11,17 +11,45 @@ class TodoListTile extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (!todo.done) { final tileColor = todo.done
return undoneTodo(context); ? Theme.of(context).colorScheme.surfaceVariant
} : Theme.of(context).colorScheme.primaryContainer;
return doneTodo(context); final icon = todo.done
? Icon(
Icons.delete,
color: Theme.of(context).colorScheme.error,
)
: Icon(
Icons.check_box,
color: Theme.of(context).colorScheme.primary,
);
return ListTile(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
tileColor: tileColor,
contentPadding: const EdgeInsets.only(left: 24, right: 12),
title: Text(
todo.title,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
onTap: () => _onListTileTapped(context),
trailing: IconButton(
onPressed: onPressed,
icon: icon,
),
);
} }
Widget undoneTodo(BuildContext context) { Widget undoneTodo(BuildContext context) {
return ListTile( return ListTile(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
tileColor: Theme.of(context).colorScheme.primaryContainer, tileColor: Theme.of(context).colorScheme.primaryContainer,
title: Text(todo.title), contentPadding: const EdgeInsets.only(left: 24, right: 12),
title: Text(
todo.title,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
onTap: () => _onListTileTapped(context), onTap: () => _onListTileTapped(context),
trailing: IconButton( trailing: IconButton(
onPressed: onPressed, onPressed: onPressed,
@@ -37,7 +65,11 @@ class TodoListTile extends StatelessWidget {
return ListTile( return ListTile(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
tileColor: Theme.of(context).colorScheme.surfaceVariant, tileColor: Theme.of(context).colorScheme.surfaceVariant,
title: Text(todo.title), title: Text(
todo.title,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
onTap: () => _onListTileTapped(context), onTap: () => _onListTileTapped(context),
trailing: IconButton( trailing: IconButton(
onPressed: onPressed, onPressed: onPressed,