
- 新增设置功能模块,包含用户信息管理和设置选项。 - 实现动态视图,展示用户动态内容。 - 更新HomeView以支持设置页面的展示和动态视图的切换。 - 添加底部导航栏,增强用户体验。 - 更新相关视图和组件,确保一致的UI风格和交互体验。
134 lines
4.6 KiB
Swift
134 lines
4.6 KiB
Swift
import SwiftUI
|
||
|
||
struct FeedView: View {
|
||
var body: some View {
|
||
ScrollView {
|
||
VStack(spacing: 20) {
|
||
// 顶部标题
|
||
HStack {
|
||
Spacer()
|
||
Text("Enjoy your Life Time")
|
||
.font(.system(size: 22, weight: .semibold))
|
||
.foregroundColor(.white)
|
||
Spacer()
|
||
}
|
||
.padding(.top, 20)
|
||
|
||
// 心脏图标
|
||
Image(systemName: "heart.fill")
|
||
.font(.system(size: 60))
|
||
.foregroundColor(.red)
|
||
.padding(.top, 40)
|
||
|
||
// 励志文字
|
||
Text("The disease is like a cruel ruler,\nand time is our most precious treasure.\nEvery moment we live is a victory\nagainst the inevitable.")
|
||
.font(.system(size: 16))
|
||
.multilineTextAlignment(.center)
|
||
.foregroundColor(.white.opacity(0.9))
|
||
.padding(.horizontal, 30)
|
||
.padding(.top, 20)
|
||
|
||
// 模拟动态卡片
|
||
LazyVStack(spacing: 16) {
|
||
ForEach(0..<3) { index in
|
||
DynamicCardView(index: index)
|
||
}
|
||
}
|
||
.padding(.horizontal, 16)
|
||
.padding(.top, 30)
|
||
|
||
// 底部安全区域
|
||
Color.clear.frame(height: 100)
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// MARK: - 动态卡片组件
|
||
struct DynamicCardView: View {
|
||
let index: Int
|
||
|
||
var body: some View {
|
||
VStack(alignment: .leading, spacing: 12) {
|
||
// 用户信息行
|
||
HStack(spacing: 12) {
|
||
// 头像
|
||
Circle()
|
||
.fill(Color.blue.opacity(0.6))
|
||
.frame(width: 40, height: 40)
|
||
.overlay(
|
||
Text("👤")
|
||
.font(.system(size: 20))
|
||
)
|
||
|
||
VStack(alignment: .leading, spacing: 2) {
|
||
HStack {
|
||
Text("NAMENAMENAME....")
|
||
.font(.system(size: 14, weight: .medium))
|
||
.foregroundColor(.white)
|
||
|
||
Spacer()
|
||
|
||
Text("ID:7271557")
|
||
.font(.caption)
|
||
.foregroundColor(.white.opacity(0.7))
|
||
}
|
||
|
||
Text("09/12")
|
||
.font(.caption)
|
||
.foregroundColor(.white.opacity(0.7))
|
||
}
|
||
}
|
||
|
||
// 内容文字
|
||
Text("这是动态内容 \(index + 1)。今天是美好的一天,分享一些生活中的点点滴滴。")
|
||
.font(.system(size: 15))
|
||
.foregroundColor(.white)
|
||
.lineLimit(nil)
|
||
|
||
// 图片网格(模拟)
|
||
LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 8), count: 3), spacing: 8) {
|
||
ForEach(0..<3) { imageIndex in
|
||
Rectangle()
|
||
.fill(Color.gray.opacity(0.3))
|
||
.aspectRatio(1, contentMode: .fit)
|
||
.overlay(
|
||
Image(systemName: "photo")
|
||
.foregroundColor(.white.opacity(0.6))
|
||
)
|
||
}
|
||
}
|
||
|
||
// 互动按钮
|
||
HStack(spacing: 20) {
|
||
Button(action: {}) {
|
||
HStack(spacing: 4) {
|
||
Image(systemName: "message")
|
||
.font(.system(size: 16))
|
||
Text("354")
|
||
.font(.system(size: 14))
|
||
}
|
||
.foregroundColor(.white.opacity(0.8))
|
||
}
|
||
|
||
Button(action: {}) {
|
||
HStack(spacing: 4) {
|
||
Image(systemName: "heart")
|
||
.font(.system(size: 16))
|
||
Text("354")
|
||
.font(.system(size: 14))
|
||
}
|
||
.foregroundColor(.white.opacity(0.8))
|
||
}
|
||
|
||
Spacer()
|
||
}
|
||
.padding(.top, 8)
|
||
}
|
||
.padding(16)
|
||
.background(
|
||
Color.white.opacity(0.1)
|
||
.cornerRadius(12)
|
||
)
|
||
}
|
||
} |