88import SwiftUI
99
1010struct TodoItemRow : View {
11+ @Environment ( \. sceneWidth) private var sceneWidth
1112 private let item : TodoListItem
1213
1314 init ( _ item: TodoListItem ) {
@@ -16,18 +17,12 @@ struct TodoItemRow: View {
1617
1718 var body : some View {
1819 HStack {
19- VStack ( alignment: . leading, spacing: 5 ) {
20+ Image ( systemName: " checkmark.circle " )
21+ . resizable ( )
22+ . frame ( width: sceneWidth * 0.08 , height: sceneWidth * 0.08 )
23+ . foregroundStyle ( item. isCompleted ? . green : . secondary)
24+ VStack ( alignment: . leading, spacing: 0 ) {
2025 HStack {
21- if item. isPinned {
22- Image ( systemName: " star.fill " )
23- . font ( . headline)
24- . foregroundStyle ( . orange)
25- }
26- if item. isCompleted {
27- Image ( systemName: " checkmark.circle.fill " )
28- . font ( . headline)
29- . foregroundStyle ( . green)
30- }
3126 Text ( item. title)
3227 . font ( . headline)
3328 . foregroundStyle ( Color ( . label) )
@@ -39,6 +34,15 @@ struct TodoItemRow: View {
3934 . fixedSize ( horizontal: true , vertical: false )
4035 }
4136 }
37+ HStack ( spacing: 4 ) {
38+ if item. isPinned {
39+ Image ( systemName: " star.fill " )
40+ . font ( . headline)
41+ . foregroundStyle ( . orange)
42+ }
43+ RelativeTimeText ( date: item. updatedAt)
44+ }
45+ . frame ( height: UIFont . preferredFont ( forTextStyle: . headline) . lineHeight)
4246 if !item. tags. isEmpty {
4347 TagList ( item. tags, lineLimit: 1 )
4448 }
@@ -48,6 +52,6 @@ struct TodoItemRow: View {
4852 . font ( . caption2. bold ( ) )
4953 . foregroundStyle ( . gray)
5054 }
51- . padding ( . vertical, item . tags . isEmpty ? 20 : 4 )
55+ . padding ( . vertical, 12 )
5256 }
5357}
0 commit comments