显示简介

This commit is contained in:
anlicheng 2025-02-25 13:05:36 +08:00
parent a8e3a68879
commit f080cd4d13

View File

@ -54,13 +54,13 @@ final class DetailModel {
self.config = DisplayConfig(name: "前排占位", bgColor: .black, fontColor: .white)
case "following":
self.status = rawValue
self.config = DisplayConfig(name: "追番", bgColor: .white, fontColor: Color(hex: "#333333"))
self.config = DisplayConfig(name: "追番", bgColor: .black, fontColor: .white)
case "catching_up":
self.status = rawValue
self.config = DisplayConfig(name: "补番", bgColor: .black, fontColor: .white)
case "dropping":
self.status = rawValue
self.config = DisplayConfig(name: "弃番", bgColor: .black, fontColor: .white)
self.config = DisplayConfig(name: "弃番", bgColor: .white, fontColor: Color(hex: "#333333"))
case "finished":
self.status = rawValue
self.config = DisplayConfig(name: "补完", bgColor: .black, fontColor: .white)
@ -134,6 +134,7 @@ final class DetailModel {
struct DetailView: View {
@State var detailModel = DetailModel()
@State var showAllSummary: Bool = false
let id: Int
var body: some View {
@ -144,11 +145,27 @@ struct DetailView: View {
.font(.system(size: 28))
.fontWeight(.bold)
.foregroundColor(Color(hex: "#333333"))
Text(detailModel.summary)
.lineLimit(3)
.multilineTextAlignment(.leading)
.frame(maxWidth: .infinity, alignment: .leading)
if showAllSummary {
Text(detailModel.summary)
.lineLimit(nil)
.multilineTextAlignment(.leading)
.frame(maxWidth: .infinity, alignment: .leading)
.onTapGesture {
withAnimation {
self.showAllSummary = false
}
}
} else {
Text(detailModel.summary)
.lineLimit(3)
.multilineTextAlignment(.leading)
.frame(maxWidth: .infinity, alignment: .leading)
.onTapGesture {
withAnimation {
self.showAllSummary = true
}
}
}
}
.padding([.top, .leading], 10)
.background(Color(hex: "#F2F2F2"), ignoresSafeAreaEdges: [.bottom])