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

Fix clickable area for buttons in 'Sync with Another Device' view #2011

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -63,41 +63,33 @@ struct SyncWithAnotherDeviceView: View {

fileprivate func pickerView() -> some View {
return HStack(spacing: 0) {
pickerOptionView(imageName: "QR-Icon", title: UserText.syncWithAnotherDeviceShowCodeButton, tag: 0)
pickerOptionView(imageName: "Keyboard-16D", title: UserText.syncWithAnotherDeviceEnterCodeButton, tag: 1)
}
.frame(width: 348, height: 32)
.roundedBorder()
}

@ViewBuilder
fileprivate func pickerOptionView(imageName: String, title: String, tag: Int) -> some View {
Button {
selectedSegment = tag
} label: {
HStack {
Image("QR-Icon")
Text(UserText.syncWithAnotherDeviceShowCodeButton)
}
.onTapGesture {
selectedSegment = 0
}
.frame(width: 172, height: 28)
.background(
ZStack {
RoundedRectangle(cornerRadius: 8)
.stroke(selectedSegment == 0 ? Color("BlackWhite10") : .clear, lineWidth: 1)
RoundedRectangle(cornerRadius: 8)
.fill(selectedSegment == 0 ? Color("PickerViewSelected") : Color("BlackWhite1"))
}
)
HStack {
Image("Keyboard-16D")
Text(UserText.syncWithAnotherDeviceEnterCodeButton)
}
.onTapGesture {
selectedSegment = 1
Image(imageName)
Text(title)
}
.frame(width: 172, height: 28)
.background(
ZStack {
RoundedRectangle(cornerRadius: 8)
.stroke(selectedSegment == 1 ? Color("BlackWhite10") : .clear, lineWidth: 1)
.stroke(selectedSegment == tag ? Color("BlackWhite10") : .clear, lineWidth: 1)
RoundedRectangle(cornerRadius: 8)
.fill(selectedSegment == 1 ? Color("PickerViewSelected") : Color("BlackWhite1"))
.fill(selectedSegment == tag ? Color("PickerViewSelected") : Color("BlackWhite1"))
}
)
}
.frame(width: 348, height: 32)
.roundedBorder()
.buttonStyle(.plain)
}

fileprivate func scanQRCodeView() -> some View {
Expand Down
Loading