feat(View): 增加 NotificationView

增加 NotificationView

Signed-off-by: Ching <loooching@gmail.com>
This commit is contained in:
Ching 2023-05-07 19:39:45 +08:00
parent 22eedb04a4
commit 8392e8a86e
4 changed files with 86 additions and 9 deletions

View File

@ -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 = "<group>"; };
24C1E5952A07A9D300F09364 /* Avatar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Avatar.swift; sourceTree = "<group>"; };
24C1E5992A07AC6D00F09364 /* ToolBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolBar.swift; sourceTree = "<group>"; };
24C1E59B2A07BB5C00F09364 /* NotificationRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationRow.swift; sourceTree = "<group>"; };
/* 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 = "<group>";
@ -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 */,

View File

@ -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("科代")

View File

@ -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()
}
}

View File

@ -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()
}
}
}
}
}