MCPcopy Index your code
hub / github.com/flet-dev/flet / Task

Class Task

sdk/python/examples/apps/todo/main.py:4–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2
3
4class Task(ft.Column):
5 def __init__(self, task_name, task_delete):
6 super().__init__()
7 self.completed = False
8 self.task_name = task_name
9 self.task_delete = task_delete
10
11 def build(self):
12 self.display_task = ft.Checkbox(
13 value=False, label=self.task_name, on_change=self.status_changed
14 )
15 self.edit_name = ft.TextField(expand=1)
16
17 self.display_view = ft.Row(
18 alignment=ft.MainAxisAlignment.SPACE_BETWEEN,
19 vertical_alignment=ft.CrossAxisAlignment.CENTER,
20 controls=[
21 self.display_task,
22 ft.Row(
23 spacing=0,
24 controls=[
25 ft.IconButton(
26 icon=ft.Icons.CREATE_OUTLINED,
27 tooltip="Edit To-Do",
28 on_click=self.edit_clicked,
29 ),
30 ft.IconButton(
31 ft.Icons.DELETE_OUTLINE,
32 tooltip="Delete To-Do",
33 on_click=self.delete_clicked,
34 ),
35 ],
36 ),
37 ],
38 )
39
40 self.edit_view = ft.Row(
41 visible=False,
42 alignment=ft.MainAxisAlignment.SPACE_BETWEEN,
43 vertical_alignment=ft.CrossAxisAlignment.CENTER,
44 controls=[
45 self.edit_name,
46 ft.IconButton(
47 icon=ft.Icons.DONE_OUTLINE_OUTLINED,
48 icon_color=ft.Colors.GREEN,
49 tooltip="Update To-Do",
50 on_click=self.save_clicked,
51 ),
52 ],
53 )
54 self.controls = [self.display_view, self.edit_view]
55
56 def edit_clicked(self, e):
57 self.edit_name.value = self.display_task.label
58 self.display_view.visible = False
59 self.edit_view.visible = True
60
61 def save_clicked(self, e):

Callers 1

add_clickedMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected