Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add service tab in settings use SwiftUI #311

Merged
merged 23 commits into from
Jan 14, 2024
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f04e659
feat: add service tab screen use SwiftUI
phlpsong Jan 6, 2024
f5b6bb1
feat: add service list move function
phlpsong Jan 7, 2024
7ae9c0a
fix: Removed a file change
phlpsong Jan 7, 2024
f0e7b11
fix: service list order issue and UI change
phlpsong Jan 7, 2024
238f524
style: format code
tisfeng Jan 7, 2024
cac1639
fix: change service tab frame size
phlpsong Jan 7, 2024
505f440
Merge branch 'dev' into phlpsong/service_tab_swiftui
phlpsong Jan 7, 2024
2efd70d
feat: update the style of service list
phlpsong Jan 8, 2024
c3ba762
Merge branch 'dev' into phlpsong/service_tab_swiftui
phlpsong Jan 8, 2024
c9d2d78
style: auto update Localizable.xcstrings
tisfeng Jan 8, 2024
76cb6d9
perf: remove unused variables
tisfeng Jan 8, 2024
8c388c1
fix: service list index of bounds issue and tap issue
phlpsong Jan 8, 2024
ea8c9e0
fix: serviceTypes count is greater than services count, cause crash
tisfeng Jan 8, 2024
15a6372
Merge branch 'phlpsong/service_tab_swiftui' of https://github.com/phl…
phlpsong Jan 8, 2024
2e60d33
perf: adjust service rowHeight to 30
tisfeng Jan 8, 2024
a5e957f
perf: hide scrollIndicators
tisfeng Jan 8, 2024
b0e0c75
Merge branch 'phlpsong/service_tab_swiftui' of https://github.com/phl…
phlpsong Jan 8, 2024
e72ef0d
fix: reset service list selection
phlpsong Jan 8, 2024
afbe775
feat: optimize tab selection window transition
phlpsong Jan 9, 2024
50770c8
fix: window frame not reset issue
phlpsong Jan 9, 2024
b05f2ba
fix: onTap conflict with onMove in service tab
phlpsong Jan 10, 2024
4b61669
Merge branch 'dev' into phlpsong/service_tab_swiftui
phlpsong Jan 14, 2024
53c393d
fix: remove tap event print
phlpsong Jan 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Easydict/NewApp/View/SettingView/Tabs/ServiceTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@ struct ServiceTab: View {
}

var serviceList: some View {
List {
ForEach(Array(serviceTypes.enumerated()), id: \.offset) { index, _ in
List(selection: $selectedIndex) {
ForEach(Array(zip(serviceTypes.indices, serviceTypes)), id: \.0) { index, _ in
ServiceItemView(
service: $services[index]
tisfeng marked this conversation as resolved.
Show resolved Hide resolved
) { isEnable in
serviceToggled(index: index, isEnable: isEnable)
}
.tag(index)
.contentShape(Rectangle())
.onTapGesture {
if selectedIndex == nil || selectedIndex != index {
selectedIndex = index
} else {
selectedIndex = nil
}
}
.listRowBackground(selectedIndex == index ? Color("service_cell_highlight") : Color.clear)
// .onTapGesture {
// if selectedIndex == nil || selectedIndex != index {
// selectedIndex = index
// } else {
// selectedIndex = nil
// }
// }
// .listRowBackground(selectedIndex == index ? Color("service_cell_highlight") : Color.clear)
phlpsong marked this conversation as resolved.
Show resolved Hide resolved
}
.onMove(perform: { indices, newOffset in
onServiceItemMove(fromOffsets: indices, toOffset: newOffset)
Expand Down