Skip to content

Commit

Permalink
fix: cannot move and scroll position error
Browse files Browse the repository at this point in the history
  • Loading branch information
CanglongCl committed Jan 15, 2024
1 parent cab5d00 commit 5b31ce4
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions Easydict/NewApp/View/SettingView/Tabs/ServiceTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ struct ServiceTab: View {
}
.frame(minWidth: 500)
}
.onChange(of: windowType) { _ in
selectedService = nil
}
}
}

Expand All @@ -78,7 +75,7 @@ private struct ServiceItems: View {

private var servicesWithID: [(QueryService, String)] {
services.map { service in
(service, "\(service.name())\(windowType)")
(service, service.name())
}
}

Expand Down Expand Up @@ -137,22 +134,17 @@ private struct ServiceItemView: View {
.frame(width: 20.0, height: 20.0)
Text(service.inner.name())
}
.onTapGesture {
selectedService = service.inner
}
}
.padding(4.0)
.toggleStyle(.switch)
.controlSize(.small)
.listRowSeparator(.hidden)
.listRowBackground(selectedService == service.inner ? Color("service_cell_highlight") : tableColor)
.listRowInsets(.init())
.padding(10)
.background {
if selectedService != service.inner {
tableColor.onTapGesture {
selectedService = service.inner
}
.listRowBackground(selectedService == service.inner ? Color("service_cell_highlight") : tableColor)
.overlay {
TapHandler {
selectedService = service.inner
}
}
}
Expand Down

0 comments on commit 5b31ce4

Please sign in to comment.