fix(ios): 重写 LibraryDetailPage body — 清理 ZStack/VStack 嵌套结构
- ZStack { Color; VStack { ... } } 结构正确分离
- ScrollView 内 VStack 的 if/else 分支独立清晰
- Source 列表去掉多余外层 VStack
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
6bb0ae6e29
commit
011dabcb43
@ -149,7 +149,9 @@ struct LibraryDetailPage: View {
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
ZStack { Color.zxBg0.ignoresSafeArea(); VStack(spacing: 0) {
|
||||
ZStack {
|
||||
Color.zxBg0.ignoresSafeArea()
|
||||
VStack(spacing: 0) {
|
||||
Picker("", selection: $detailTab) {
|
||||
Text("知识点").tag(0)
|
||||
Text("资料来源").tag(1)
|
||||
@ -157,10 +159,14 @@ struct LibraryDetailPage: View {
|
||||
.pickerStyle(.segmented)
|
||||
.padding(.horizontal, 20).padding(.top, 8)
|
||||
|
||||
ScrollView { VStack(spacing: 12) {
|
||||
ScrollView {
|
||||
VStack(spacing: 12) {
|
||||
if detailTab == 0 {
|
||||
if viewModel.isLoading && viewModel.items.isEmpty {
|
||||
VStack(spacing: 12) { ZXLoadingView(size: 36, lineWidth: 3); Text("加载中…").font(.system(size: 13)).foregroundColor(Color.zxF04) }
|
||||
VStack(spacing: 12) {
|
||||
ZXLoadingView(size: 36, lineWidth: 3)
|
||||
Text("加载中…").font(.system(size: 13)).foregroundColor(Color.zxF04)
|
||||
}
|
||||
.frame(maxWidth: .infinity).padding(.top, 80)
|
||||
}
|
||||
ForEach(viewModel.items) { item in
|
||||
@ -190,14 +196,15 @@ struct LibraryDetailPage: View {
|
||||
ZXLoadMoreFooter { await viewModel.loadMore(knowledgeBaseId: knowledgeBaseId) }
|
||||
}
|
||||
} else {
|
||||
// 资料来源 Tab
|
||||
if isLoadingSources {
|
||||
VStack(spacing: 12) { ProgressView().tint(Color.zxPurple); Text("加载中…").font(.system(size: 13)).foregroundColor(Color.zxF04) }.padding(.top, 80)
|
||||
VStack(spacing: 12) {
|
||||
ProgressView().tint(Color.zxPurple)
|
||||
Text("加载中…").font(.system(size: 13)).foregroundColor(Color.zxF04)
|
||||
}.padding(.top, 80)
|
||||
} else if sources.isEmpty {
|
||||
Text("暂无资料来源").font(.system(size: 13)).foregroundColor(Color.zxF03).padding(.top, 40)
|
||||
} else {
|
||||
ForEach(sources) { src in
|
||||
VStack(spacing: 0) {
|
||||
HStack(spacing: 12) {
|
||||
Image(systemName: src.type == "file" ? "doc.fill" : "link")
|
||||
.font(.system(size: 18)).foregroundColor(Color.zxPurple)
|
||||
@ -224,8 +231,8 @@ struct LibraryDetailPage: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 20).padding(.bottom, 80)
|
||||
}
|
||||
.scrollIndicators(.hidden)
|
||||
.zxPullToRefresh { await viewModel.refresh(knowledgeBaseId: knowledgeBaseId) }
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user