This commit is contained in:
anlicheng 2025-06-30 18:49:47 +08:00
parent 72d73f9a2f
commit e7549803b6

View File

@ -25,23 +25,19 @@ struct SearchView: View {
@State private var isFocused: Bool = true @State private var isFocused: Bool = true
var body: some View { var body: some View {
VStack(spacing: 12) { VStack(spacing: 0) {
if showSearchResult { Color.clear
if searchModel.dramaGroups.isEmpty { .frame(height: 8)
Spacer()
Text("什么都没有找到") VStack {
.font(.system(size: 18))
.foregroundColor(Color(hex: "#333333"))
Spacer()
} else {
ScrollView(.vertical, showsIndicators: false) { ScrollView(.vertical, showsIndicators: false) {
LazyVStack(alignment: .center, spacing: 10) { LazyVStack(alignment: .center, spacing: 10) {
ForEach(searchModel.dramaGroups, id: \.group_id) { group in ForEach(searchModel.dramaGroups, id: \.group_id) { group in
SearchDramaGroupView(group: group) SearchDramaGroupView(group: group)
} }
} }
.padding(.top, 8)
} }
.frame(maxWidth: .infinity, maxHeight: .infinity)
.onTapGesture { .onTapGesture {
isFocused = false isFocused = false
} }
@ -51,14 +47,13 @@ struct SearchView: View {
} }
) )
} }
} else { .overlay(alignment: .center) {
// Text("什么都没有找到")
Spacer() .font(.system(size: 18))
.foregroundColor(Color(hex: "#333333"))
.opacity(showSearchResult && searchModel.dramaGroups.isEmpty ? 1 : 0)
} }
} }
.padding(.top, 10)
.background(Color(.systemBackground))
.navigationTitle("") .navigationTitle("")
.toolbar { .toolbar {
ToolbarItem(placement: .principal) { ToolbarItem(placement: .principal) {
@ -69,8 +64,6 @@ struct SearchView: View {
.id(toolbarID) .id(toolbarID)
} }
} }
.padding(.horizontal, 12)
.ignoresSafeArea(.keyboard, edges: .bottom) //
.onAppear { .onAppear {
toolbarID = UUID() toolbarID = UUID()
} }