Skip to content

Commit

Permalink
fix picker background color
Browse files Browse the repository at this point in the history
  • Loading branch information
DragonCat4012 committed Dec 13, 2023
1 parent f6761ba commit 76e756a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Calq/lib/ColorExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ extension Color {
static let backgroundColor = Color(UIColor.backgroundColor)
static let cardShadow = Color(UIColor.cardShadow)

static let secondarySystemBackground = Color(UIColor.secondarySystemBackground)

init(hexString: String) {
let hexString: String = hexString.trimmingCharacters(
in: CharacterSet.whitespacesAndNewlines
Expand Down
13 changes: 8 additions & 5 deletions Calq/lib/SegmentedPickerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ struct SegmentedPickerView: View {
var body: some View {
ZStack {
RoundedRectangle(cornerRadius: 8)
.fill(Color.white)
.fill(Color.secondarySystemBackground)
.frame(height: 30)
.shadow(radius: 2)
.shadow(color: .cardShadow, radius: 2)

HStack {
ForEach(Array(entries.enumerated()), id: \.offset) { index, item in
Expand All @@ -26,14 +26,17 @@ struct SegmentedPickerView: View {
vm.changedIndex(index)
} label: {
VStack(spacing: 2) {
Text(item)
.foregroundColor(isSelected ? vm.color : .gray)
if isSelected {
Text(item)
.foregroundColor(isSelected ? vm.color : .gray)
.bold()
Rectangle()
.fill(vm.color)
.frame(height: 2)
.padding(.horizontal, 4)

} else {
Text(item)
.foregroundColor(isSelected ? vm.color : .gray)
}
}.frame(maxWidth: .infinity)
}.frame(maxWidth: .infinity)
Expand Down

0 comments on commit 76e756a

Please sign in to comment.