diff --git a/duduji.xcodeproj/project.pbxproj b/duduji.xcodeproj/project.pbxproj index c64e076..fd8a80d 100644 --- a/duduji.xcodeproj/project.pbxproj +++ b/duduji.xcodeproj/project.pbxproj @@ -22,6 +22,7 @@ 24A07D052A07A33900F4ECA8 /* NotificationTabView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24A07D042A07A33900F4ECA8 /* NotificationTabView.swift */; }; 24C1E5962A07A9D300F09364 /* Avatar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24C1E5952A07A9D300F09364 /* Avatar.swift */; }; 24C1E59A2A07AC6D00F09364 /* ToolBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24C1E5992A07AC6D00F09364 /* ToolBar.swift */; }; + 24C1E59C2A07BB5C00F09364 /* NotificationRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24C1E59B2A07BB5C00F09364 /* NotificationRow.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -42,6 +43,7 @@ 24A07D042A07A33900F4ECA8 /* NotificationTabView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationTabView.swift; sourceTree = ""; }; 24C1E5952A07A9D300F09364 /* Avatar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Avatar.swift; sourceTree = ""; }; 24C1E5992A07AC6D00F09364 /* ToolBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolBar.swift; sourceTree = ""; }; + 24C1E59B2A07BB5C00F09364 /* NotificationRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationRow.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -135,6 +137,7 @@ 24A07CF42A0763B600F4ECA8 /* StatusRow.swift */, 24C1E5952A07A9D300F09364 /* Avatar.swift */, 24C1E5992A07AC6D00F09364 /* ToolBar.swift */, + 24C1E59B2A07BB5C00F09364 /* NotificationRow.swift */, ); path = Components; sourceTree = ""; @@ -313,6 +316,7 @@ 24C1E5962A07A9D300F09364 /* Avatar.swift in Sources */, 24A07CFC2A07A26A00F4ECA8 /* TimeLineTabView.swift in Sources */, 24A07CF32A03E80200F4ECA8 /* TimeLineView.swift in Sources */, + 24C1E59C2A07BB5C00F09364 /* NotificationRow.swift in Sources */, 24A07CD02A026DDA00F4ECA8 /* dudujiApp.swift in Sources */, 24A07D052A07A33900F4ECA8 /* NotificationTabView.swift in Sources */, 24A07CFA2A076E5400F4ECA8 /* MainTabView.swift in Sources */, diff --git a/duduji/Core/Authentication/Views/AccountListView.swift b/duduji/Core/Authentication/Views/AccountListView.swift index f9ee22a..24e9f24 100644 --- a/duduji/Core/Authentication/Views/AccountListView.swift +++ b/duduji/Core/Authentication/Views/AccountListView.swift @@ -45,20 +45,17 @@ struct AccountListView_Previews: PreviewProvider { extension AccountListView { var accountRowView: some View { HStack { - ZStack { + ZStack(alignment: .topTrailing) { RoundedRectangle(cornerRadius: 6) .fill(Color.blue) .frame(width: 48, height: 48) .overlay( - RoundedRectangle(cornerRadius: 6) - .stroke(.gray.opacity(0.35), lineWidth: 1) + RoundedRectangle(cornerRadius: 6) + .stroke(.gray.opacity(0.35), lineWidth: 1) ) Image(systemName: "checkmark.circle.fill") - .foregroundColor(.green) - .background(.white) - .clipShape(Circle()) - .offset(x: 15, y: -15) - .font(.title) + .foregroundStyle(.white, .green.opacity(0.9)) + .offset(x: 5, y: -5) } VStack(alignment: .leading) { Text("科代") diff --git a/duduji/Core/Components/NotificationRow.swift b/duduji/Core/Components/NotificationRow.swift new file mode 100644 index 0000000..ff2ca03 --- /dev/null +++ b/duduji/Core/Components/NotificationRow.swift @@ -0,0 +1,70 @@ +// +// NotificationRow.swift +// duduji +// +// Created by ching on 2023/5/7. +// + +import SwiftUI + +struct NotificationRow: View { + var body: some View { + VStack { + HStack { + VStack { + ZStack(alignment: .topLeading) { + RoundedRectangle(cornerRadius: 6) + .fill(Color.blue) + .frame(width: 48, height: 48) + .overlay( + RoundedRectangle(cornerRadius: 6) + .stroke(.gray.opacity(0.5), lineWidth: 2) + ) + ZStack(alignment: .center) { + Circle() + .strokeBorder(Color.white, lineWidth: 1) + .background(Circle().foregroundColor(Color.yellow)) + .frame(width: 24, height: 24) + + Image(systemName: "star.fill") + .resizable() + .scaledToFit() + .frame(width: 12, height: 12) + .foregroundColor(.white) + } + .offset(x: -8, y: -8) + } + Spacer() + } + VStack(alignment: .leading, spacing: 4) { + HStack(alignment: .center, spacing: 2) { + Text("科代") + .bold() + Text("星标") + .textContentType(.none) + .font(.subheadline) + Text("·") + Text("4分钟前") + .foregroundColor(.gray) + .font(.subheadline) + } + HStack { + Text("偶然刷到一个 INS视频,帅帅的藏族模特走\n路,但配乐的一个蒙古歌,歌词还是汉语中文。\n 一群西方人在下面评论:多么美好的藏族文化啊!\n一时间不知道说啥。。。\n嗐,白人") + .multilineTextAlignment(.leading) + Spacer() + } + Spacer() + } + } + } + .padding(.horizontal) + Divider() + .padding(.vertical) + } +} + +struct NotificationRow_Previews: PreviewProvider { + static var previews: some View { + NotificationRow() + } +} diff --git a/duduji/Core/Notification/Views/NotificationView.swift b/duduji/Core/Notification/Views/NotificationView.swift index acd9e55..47e44fe 100644 --- a/duduji/Core/Notification/Views/NotificationView.swift +++ b/duduji/Core/Notification/Views/NotificationView.swift @@ -9,7 +9,13 @@ import SwiftUI struct NotificationView: View { var body: some View { - Text("Notification View") + ScrollView { + LazyVStack { + ForEach(0 ... 25, id: \.self) { _ in + NotificationRow() + } + } + } } }