-
Notifications
You must be signed in to change notification settings - Fork 0
/
todo_item.dart
68 lines (64 loc) · 1.9 KB
/
todo_item.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import 'package:flutter/material.dart';
import './todo.dart';
import './colors.dart';
class ToDoItem extends StatelessWidget {
final ToDo todo;
final onToDoChanged;
final onDeleteItem;
const ToDoItem({
Key? key,
required this.todo,
required this.onToDoChanged,
required this.onDeleteItem,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Container(
margin: EdgeInsets.only(bottom: 20),
child: ListTile(
onTap: () {
// print('Clicked on Todo Item.');
onToDoChanged(todo);
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
contentPadding: EdgeInsets.symmetric(horizontal: 20, vertical: 5),
tileColor: Colors.white,
leading: Icon(
todo.isDone ? Icons.check_box : Icons.check_box_outline_blank,
color: tdBlue,
),
title: Text(
todo.todoText!,
style: TextStyle(
fontSize: 16,
color: tdBlack,
decoration: todo.isDone ? TextDecoration.lineThrough : null,
),
),
trailing: Container(
padding: EdgeInsets.all(0),
margin: EdgeInsets.symmetric(vertical: 12),
height: 35,
width: 35,
decoration: BoxDecoration(
color: tdRed,
borderRadius: BorderRadius.circular(5),
),
child: IconButton(
color: Colors.white,
iconSize: 18,
icon: Icon(Icons.delete),
onPressed: () {
// print('Clicked on delete icon');
onDeleteItem(todo.id);
},
),
),
),
),
);
}
}