fix index color
This commit is contained in:
parent
8d2d972ac6
commit
c44067db1b
28
dimensionhub/Core/ColorExtension.swift
Normal file
28
dimensionhub/Core/ColorExtension.swift
Normal file
@ -0,0 +1,28 @@
|
||||
//
|
||||
// ColorExtension.swift
|
||||
// dimensionhub
|
||||
//
|
||||
// Created by 安礼成 on 2025/2/22.
|
||||
//
|
||||
import SwiftUI
|
||||
|
||||
extension Color {
|
||||
|
||||
init(hex: String, opacity: Double = 1) {
|
||||
let hex = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
|
||||
let characters = Array(hex)
|
||||
|
||||
let r = Int(String(characters[0..<2]), radix: 16)!
|
||||
let g = Int(String(characters[2..<4]), radix: 16)!
|
||||
let b = Int(String(characters[4..<6]), radix: 16)!
|
||||
|
||||
self.init(
|
||||
.sRGB,
|
||||
red: Double(r) / 255,
|
||||
green: Double(g) / 255,
|
||||
blue: Double(b) / 255,
|
||||
opacity: opacity
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
@ -125,7 +125,7 @@ struct IndexView: View {
|
||||
// 是否显示日期弹出层
|
||||
@State private var selectGroupId: String = ""
|
||||
@State private var showDateNavPopover: Bool = false
|
||||
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .center) {
|
||||
|
||||
@ -138,13 +138,13 @@ struct IndexView: View {
|
||||
}
|
||||
}
|
||||
.frame(height: 50)
|
||||
.background(Color.yellow)
|
||||
.border(Color.red)
|
||||
.background(Color(hex: "#F2F2F2"), ignoresSafeAreaEdges: .bottom)
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Spacer()
|
||||
Text("番剧补完计划")
|
||||
.font(.system(size: 24))
|
||||
.foregroundColor(Color(hex: "#999999"))
|
||||
}
|
||||
|
||||
ForEach(indexModel.dramas, id: \.id) { drama in
|
||||
@ -154,14 +154,14 @@ struct IndexView: View {
|
||||
// 基于日期的更新列表
|
||||
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
VStack(alignment: .center, spacing: 20) {
|
||||
VStack(alignment: .center, spacing: 10) {
|
||||
ForEach(indexModel.showUpdateDramas, id: \.id) { drama in
|
||||
switch drama.element {
|
||||
case .group(let group):
|
||||
HStack {
|
||||
Spacer()
|
||||
Text(group.groupName)
|
||||
.font(.system(size: 30))
|
||||
.font(.system(size: 18))
|
||||
.fontWeight(.regular)
|
||||
.onTapGesture {
|
||||
selectGroupId = group.groupId
|
||||
@ -179,20 +179,22 @@ struct IndexView: View {
|
||||
.frame(width: 370, height: 180)
|
||||
.overlay {
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: 10) {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
Text(item.name)
|
||||
.font(.system(size: 24))
|
||||
.font(.system(size: 16))
|
||||
.foregroundColor(Color(hex: "#333333"))
|
||||
.lineLimit(1)
|
||||
|
||||
Text(item.desc)
|
||||
.font(.system(size: 12))
|
||||
.foregroundColor(Color(hex: "#333333"))
|
||||
.lineLimit(1)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.padding([.top, .leading], 15)
|
||||
.border(Color.red)
|
||||
.padding([.top, .leading], 10)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -230,7 +232,7 @@ struct IndexView: View {
|
||||
}
|
||||
}
|
||||
.frame(width: 370)
|
||||
.edgesIgnoringSafeArea(.bottom)
|
||||
.ignoresSafeArea(edges: .bottom)
|
||||
.task {
|
||||
await self.indexModel.loadData()
|
||||
}
|
||||
@ -265,6 +267,7 @@ extension IndexView {
|
||||
NavigationLink(destination: DetailView()) {
|
||||
Text(dramaItem.title)
|
||||
.font(.system(size: 20))
|
||||
.foregroundColor(Color(hex: "#333333"))
|
||||
}
|
||||
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
@ -279,14 +282,26 @@ extension IndexView {
|
||||
}
|
||||
.frame(width: geometry.frame(in: .local).width, height: 80)
|
||||
.overlay {
|
||||
Text(item.numName)
|
||||
VStack {
|
||||
HStack(alignment: .center) {
|
||||
Text(item.numName)
|
||||
.font(.system(size: 12))
|
||||
.foregroundColor(Color(hex: "#333333"))
|
||||
|
||||
Spacer()
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.padding([.top, .leading], 5)
|
||||
}
|
||||
}
|
||||
|
||||
Text(item.name)
|
||||
.font(.system(size: 12))
|
||||
.foregroundColor(Color(hex: "#333333"))
|
||||
.lineLimit(1)
|
||||
}
|
||||
.frame(width: 120, height: 120)
|
||||
.frame(width: 120, height: 100)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user