@@ -27,49 +27,95 @@ struct TodoScreen: View {
2727
2828 var body : some View {
2929 NavigationView {
30-
31- VStack {
30+ ZStack {
31+ Color ( . systemGroupedBackground ) . edgesIgnoringSafeArea ( . all )
3232
3333 if todoList. isEmpty {
34- ContentUnavailableView ( " No Notes Found " , systemImage: " text.document.fill " , description: Text ( " There're no notes yet. Add a note to get started. " ) )
34+ VStack {
35+ Image ( systemName: " note.text.badge.plus " )
36+ . resizable ( )
37+ . frame ( width: 100 , height: 100 )
38+ . foregroundColor ( . gray. opacity ( 0.5 ) )
39+ Text ( " No Tasks Found " )
40+ . font ( . headline)
41+ . foregroundColor ( . gray)
42+ Text ( " Start by adding a new task. " )
43+ . font ( . subheadline)
44+ . foregroundColor ( . gray. opacity ( 0.7 ) )
45+ }
3546 } else {
3647 List {
3748 if !completedList. isEmpty {
38- Section ( " Complete Tasks " ) {
39- ForEach ( completedList) { completeItem in
40- todoRow ( for: completeItem)
49+ Section ( header: Text ( " ✅ Completed Tasks " ) ) {
50+ ForEach ( completedList) { item in
51+ todoCard ( for: item)
52+ . swipeActions ( edge: . trailing) {
53+ Button {
54+ toggleCompletion ( for: item)
55+ } label: {
56+ Label ( " UnComplete " , systemImage: item. isCompleted ? " xmark.circle " : " checkmark.circle.fill " )
57+ }
58+ . tint ( . green)
59+
60+ Button ( " Edit " ) {
61+ editItem ( item)
62+ }
63+ . tint ( . blue)
64+
65+ Button ( " Delete " , role: . destructive) {
66+ deleteItem ( item)
67+ }
68+ }
4169 }
4270 }
4371 }
44-
4572 if !inCompleteList. isEmpty {
46- Section ( " Incomplete Tasks" ) {
73+ Section ( header : Text ( " ⏳ Pending Tasks" ) ) {
4774 ForEach ( inCompleteList) { item in
48- todoRow ( for: item)
75+ todoCard ( for: item)
76+ . swipeActions ( edge: . trailing) {
77+ Button {
78+ toggleCompletion ( for: item)
79+ } label: {
80+ Label ( " Complete " , systemImage: item. isCompleted ? " xmark.circle " : " checkmark.circle.fill " )
81+ }
82+ . tint ( . green)
83+
84+ Button ( " Edit " ) {
85+ editItem ( item)
86+ }
87+ . tint ( . blue)
88+
89+ Button ( " Delete " , role: . destructive) {
90+ deleteItem ( item)
91+ }
92+ }
4993 }
5094 }
5195 }
52- } . refreshable {
53- print ( " Pull to Refresh Init " )
5496 }
55-
97+ . listStyle ( . insetGrouped)
98+ . refreshable {
99+ print ( " Refreshing tasks... " )
100+ }
56101 }
57102 }
58-
59103 . toolbar {
60- ToolbarItem {
104+ ToolbarItem ( placement : . navigationBarTrailing ) {
61105 Button {
62106 title = " "
63107 selectedItem = nil
64108 navTitle = " Add Task "
65109 isSheet. toggle ( )
66110 } label: {
67111 Image ( systemName: " plus.circle.fill " )
112+ . font ( . title2)
113+ . foregroundColor ( . blue)
68114 }
69115 }
70116 }
71117 . preferredColorScheme ( isDark ? . dark : . light)
72- . navigationTitle ( " Todo " )
118+ . navigationTitle ( " 📝 Todo List " )
73119 . sheet ( isPresented: $isSheet) {
74120 TodoSheetContent (
75121 title: $title,
@@ -92,43 +138,26 @@ struct TodoScreen: View {
92138 }
93139 }
94140
95- private func todoRow ( for item: TodoItem ) -> some View {
141+ private func todoCard ( for item: TodoItem ) -> some View {
96142 HStack {
97- Text ( item. title)
98- Spacer ( )
99- if item. isCompleted {
100- Image ( systemName: " checkmark.circle " )
101- . foregroundColor ( . green)
102- }
103- }
104- . contextMenu {
105- Button ( action: {
106- toggleCompletion ( for: item)
107- } ) {
108- Label ( item. isCompleted ? " Mark as Incomplete " : " Mark as Complete " , systemImage: item. isCompleted ? " xmark.circle.fill " : " checkmark.circle " )
109- . foregroundColor ( . blue)
110- }
111- Button ( role: . destructive) {
112- deleteItem ( item)
113- } label: {
114- Label ( " Delete " , systemImage: " trash.circle.fill " )
143+ VStack ( alignment: . leading) {
144+ Text ( item. title)
145+ . font ( . headline)
146+ . foregroundColor ( item. isCompleted ? . gray : . primary)
147+
148+ Text ( item. isCompleted ? " Completed " : " Pending " )
149+ . font ( . subheadline)
150+ . foregroundColor ( item. isCompleted ? . green : . red)
115151 }
116- }
117- . swipeActions ( edge: . trailing) {
118- Button ( " Edit " ) {
119- editItem ( item)
120- } . tint ( . blue)
121-
122- Button {
123- toggleCompletion ( for: item)
124- } label: {
125- Label ( " Completed " , systemImage: item. isCompleted ? " xmark.square " : " checkmark.square " )
126- } . tint ( . green)
152+ Spacer ( )
127153
128- Button ( " Delete " , role : . destructive ) {
129- deleteItem ( item)
130- }
154+ Image ( systemName : item . isCompleted ? " checkmark.circle.fill " : " circle " )
155+ . foregroundColor ( item. isCompleted ? . green : . gray )
156+ . font ( . title2 )
131157 }
158+ . padding ( )
159+ . background ( RoundedRectangle ( cornerRadius: 12 ) . fill ( Color . white) )
160+ . shadow ( color: Color . black. opacity ( 0.1 ) , radius: 4 , x: 0 , y: 2 )
132161 }
133162
134163 private func toggleCompletion( for item: TodoItem ) {
0 commit comments