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