This commit is contained in:
anlicheng 2025-03-03 23:16:29 +08:00
parent e1cc10c399
commit efe9de8b5e
3 changed files with 65 additions and 39 deletions

View File

@ -294,7 +294,7 @@ extension DetailView {
AsyncImage(url: URL(string: episode.thumb)) { image in
image
.resizable()
.aspectRatio(contentMode: .fit)
.aspectRatio(contentMode: .fill)
.frame(width: 90, height: 70)
.clipped()
} placeholder: {

View File

@ -390,8 +390,7 @@ extension IndexView {
AsyncImage(url: URL(string: item.thumb)) { image in
image
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: geometry.frame(in: .local).width, height: 80)
.aspectRatio(contentMode: .fill)
.clipped()
} placeholder: {
ProgressView()
@ -450,23 +449,34 @@ extension IndexView {
ForEach(group.items, id: \.id) { item in
NavigationLink(destination: DetailView(id: item.id)) {
AsyncImage(url: URL(string: item.thumb)) { image in
image.resizable()
image
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 370, height: 180)
.clipped()
} placeholder: {
ProgressView()
}
.frame(width: 370, height: 180)
.overlay {
HStack {
VStack(alignment: .leading, spacing: 8) {
Text(item.name)
.font(.system(size: 16))
.foregroundColor(Color(hex: "#333333"))
.lineLimit(1)
VStack {
VStack(alignment: .leading, spacing: 8) {
Text(item.name)
.font(.system(size: 16))
.foregroundColor(.white)
.lineLimit(1)
Text(item.status)
.font(.system(size: 12))
.foregroundColor(Color(hex: "#333333"))
.lineLimit(1)
Text(item.status)
.font(.system(size: 12))
.foregroundColor(.white)
.lineLimit(1)
}
.padding(5)
.background(
Color.black.opacity(0.6)
)
.cornerRadius(5)
Spacer()
}

View File

@ -109,31 +109,7 @@ struct ListView: View {
ScrollView(.vertical, showsIndicators: false) {
LazyVStack(alignment: .center, spacing: 15) {
ForEach(detailModel.selectedEpisodes) { episode in
HStack(alignment: .center) {
AsyncImage(url: URL(string: episode.thumb)) { image in
image.resizable()
} placeholder: {
ProgressView()
}
.frame(width: 90, height: 60)
VStack(alignment: .leading, spacing: 20) {
Text(episode.num_name)
.font(.system(size: 12))
.foregroundColor(Color(hex: "#333333"))
Text(episode.name)
.font(.system(size: 12))
.foregroundColor(Color(hex: "#333333"))
.lineLimit(1)
}
Spacer()
}
.onTapGesture {
if let playUrl = URL(string: episode.play) {
UIApplication.shared.open(playUrl)
}
}
EpisodeView(episode: episode)
}
}
}
@ -165,6 +141,46 @@ struct ListView: View {
}
extension ListView {
struct EpisodeView: View {
let episode: ListModel.Episode
var body: some View {
HStack(alignment: .center) {
AsyncImage(url: URL(string: episode.thumb)) { image in
image
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 90, height: 60)
.clipped()
} placeholder: {
ProgressView()
}
.frame(width: 90, height: 60)
VStack(alignment: .leading, spacing: 20) {
Text(episode.num_name)
.font(.system(size: 12))
.foregroundColor(Color(hex: "#333333"))
Text(episode.name)
.font(.system(size: 12))
.foregroundColor(Color(hex: "#333333"))
.lineLimit(1)
}
Spacer()
}
.onTapGesture {
if let playUrl = URL(string: episode.play) {
UIApplication.shared.open(playUrl)
}
}
}
}
}
#Preview {
ListView(id: 19625)
}