Fix connection card background on iOS

This commit is contained in:
世界
2025-12-04 11:44:31 +08:00
parent 7c8863b53a
commit c3c9284964
2 changed files with 62 additions and 58 deletions
@@ -16,16 +16,16 @@ public struct ConnectionListView: View {
Text("Empty connections") Text("Empty connections")
} else { } else {
ScrollView { ScrollView {
LazyVGrid(columns: [GridItem(.flexible())], alignment: .leading) { VStack {
ForEach(viewModel.filteredConnections(), id: \.id) { it in ForEach(viewModel.filteredConnections(), id: \.id) { it in
ConnectionView(it) ConnectionView(it)
} }
} }
}
.padding() .padding()
} }
} }
} }
}
#if !os(tvOS) #if !os(tvOS)
.toolbar { .toolbar {
ToolbarItem { ToolbarItem {
@@ -19,12 +19,12 @@ public struct ConnectionView: View {
} }
@State private var alert: AlertState? @State private var alert: AlertState?
@State private var showDetails = false
public var body: some View { public var body: some View {
FormNavigationLink { Button {
ConnectionDetailsView(connection) showDetails = true
} label: { } label: {
VStack {
HStack { HStack {
VStack(alignment: .leading) { VStack(alignment: .leading) {
HStack(alignment: .center) { HStack(alignment: .center) {
@@ -75,16 +75,12 @@ public struct ConnectionView: View {
} }
} }
.foregroundColor(.textColor) .foregroundColor(.textColor)
}
#if !os(tvOS) #if !os(tvOS)
.buttonStyle(.plain)
.padding(16) .padding(16)
.cardStyle() .cardStyle()
#endif #endif
}
.background(.clear)
}
#if !os(tvOS)
.buttonStyle(.borderless)
#endif
.alert($alert) .alert($alert)
.contextMenu { .contextMenu {
if connection.closedAt == nil { if connection.closedAt == nil {
@@ -96,6 +92,14 @@ public struct ConnectionView: View {
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
} }
} }
.background {
NavigationLink(isActive: $showDetails) {
ConnectionDetailsView(connection)
} label: {
EmptyView()
}
.opacity(0)
}
} }
private nonisolated func closeConnection() async { private nonisolated func closeConnection() async {