add nav
This commit is contained in:
parent
35a85b2a8a
commit
b1a2a13789
@ -153,9 +153,7 @@ struct DetailView: View {
|
||||
}
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Button {
|
||||
print("click me")
|
||||
} label: {
|
||||
NavigationLink(destination: ListView()) {
|
||||
Rectangle()
|
||||
.frame(width: 180, height: 50)
|
||||
.foregroundColor(Color.yellow)
|
||||
@ -166,7 +164,6 @@ struct DetailView: View {
|
||||
Text("展开全部剧集")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
@ -128,15 +128,19 @@ struct IndexView: View {
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .center) {
|
||||
HStack(alignment: .center) {
|
||||
Spacer()
|
||||
Text("亚次元")
|
||||
.padding(.top, 5)
|
||||
.padding(.bottom, 5)
|
||||
Spacer()
|
||||
}
|
||||
.background(Color.red)
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Color.clear
|
||||
.overlay {
|
||||
Text("亚次元")
|
||||
.font(.system(size: 16))
|
||||
.padding([.top, .bottom], 5)
|
||||
}
|
||||
}
|
||||
.frame(height: 50)
|
||||
.background(Color.yellow)
|
||||
.border(Color.red)
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Spacer()
|
||||
Text("番剧补完计划")
|
||||
@ -150,36 +154,38 @@ struct IndexView: View {
|
||||
// 基于日期的更新列表
|
||||
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
LazyVStack {
|
||||
VStack(alignment: .center, spacing: 20) {
|
||||
ForEach(indexModel.showUpdateDramas, id: \.id) { drama in
|
||||
switch drama.element {
|
||||
case .group(let group):
|
||||
Text(group.groupName)
|
||||
.onTapGesture {
|
||||
selectGroupId = group.groupId
|
||||
print("current group_id: \(self.selectGroupId)")
|
||||
indexModel.selectedDate = group.groupId
|
||||
showDateNavPopover = true
|
||||
}
|
||||
case .item(let item):
|
||||
VStack(alignment: .center) {
|
||||
AsyncImage(url: URL(string: item.thumb)) { image in
|
||||
image.resizable()
|
||||
} placeholder: {
|
||||
ProgressView()
|
||||
}
|
||||
.frame(width: 80, height: 80)
|
||||
.overlay {
|
||||
VStack(alignment: .leading) {
|
||||
Text(item.name)
|
||||
.lineLimit(1)
|
||||
|
||||
Text(item.desc)
|
||||
.lineLimit(1)
|
||||
HStack {
|
||||
Spacer()
|
||||
Text(group.groupName)
|
||||
.font(.system(size: 30))
|
||||
.fontWeight(.regular)
|
||||
.onTapGesture {
|
||||
selectGroupId = group.groupId
|
||||
print("current group_id: \(self.selectGroupId)")
|
||||
indexModel.selectedDate = group.groupId
|
||||
showDateNavPopover = true
|
||||
}
|
||||
}
|
||||
case .item(let item):
|
||||
AsyncImage(url: URL(string: item.thumb)) { image in
|
||||
image.resizable()
|
||||
} placeholder: {
|
||||
ProgressView()
|
||||
}
|
||||
.frame(width: 370, height: 180)
|
||||
.overlay {
|
||||
VStack(alignment: .leading) {
|
||||
Text(item.name)
|
||||
.lineLimit(1)
|
||||
|
||||
Text(item.desc)
|
||||
.lineLimit(1)
|
||||
}
|
||||
}
|
||||
.frame(width: 100, height: 120)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -215,6 +221,8 @@ struct IndexView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(width: 370)
|
||||
.edgesIgnoringSafeArea(.bottom)
|
||||
.task {
|
||||
await self.indexModel.loadData()
|
||||
}
|
||||
@ -245,9 +253,12 @@ extension IndexView {
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
Text(dramaItem.title)
|
||||
.font(.system(size: 20))
|
||||
|
||||
NavigationLink(destination: DetailView()) {
|
||||
Text(dramaItem.title)
|
||||
.font(.system(size: 20))
|
||||
}
|
||||
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
HStack(alignment: .center, spacing: 10) {
|
||||
ForEach(dramaItem.episodes, id: \.id) { item in
|
||||
|
||||
@ -77,6 +77,7 @@ final class ListModel {
|
||||
}
|
||||
|
||||
struct ListView: View {
|
||||
@Environment(\.presentationMode) var presentationMode
|
||||
@State var detailModel = DetailModel()
|
||||
|
||||
var body: some View {
|
||||
@ -90,6 +91,10 @@ struct ListView: View {
|
||||
.fontWeight(.bold)
|
||||
|
||||
Text("返回")
|
||||
.font(.system(size: 14))
|
||||
.onTapGesture {
|
||||
self.presentationMode.wrappedValue.dismiss()
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
@ -135,7 +140,7 @@ struct ListView: View {
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Button {
|
||||
print("click me")
|
||||
self.presentationMode.wrappedValue.dismiss()
|
||||
} label: {
|
||||
Rectangle()
|
||||
.frame(width: 180, height: 50)
|
||||
|
||||
@ -25,9 +25,10 @@ struct dimensionhubApp: App {
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
//IndexView()
|
||||
//DetailView()
|
||||
ListView()
|
||||
NavigationStack {
|
||||
IndexView()
|
||||
}
|
||||
.navigationViewStyle(.stack)
|
||||
}
|
||||
.modelContainer(sharedModelContainer)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user