reduce nav wheel size
This commit is contained in:
parent
a473e39169
commit
2599d8cc40
1 changed files with 2 additions and 80 deletions
|
|
@ -21,66 +21,6 @@ struct WheelNavBar: View {
|
||||||
let currentTab = tabs[min(max(selectedIndex, 0), tabs.count - 1)]
|
let currentTab = tabs[min(max(selectedIndex, 0), tabs.count - 1)]
|
||||||
|
|
||||||
VStack(spacing: 8) {
|
VStack(spacing: 8) {
|
||||||
// MARK: - Header Pill (Active Tab Title & Indicator)
|
|
||||||
HStack(spacing: 8) {
|
|
||||||
// Previous button
|
|
||||||
Button(action: {
|
|
||||||
selectPrevious()
|
|
||||||
}) {
|
|
||||||
Image(systemName: "chevron.left")
|
|
||||||
.font(.system(size: 14, weight: .bold))
|
|
||||||
.foregroundStyle(selectedIndex > 0 ? currentTab.color : Color.gray.opacity(0.4))
|
|
||||||
.frame(width: 28, height: 28)
|
|
||||||
.background(Color.white.opacity(0.15))
|
|
||||||
.clipShape(Circle())
|
|
||||||
}
|
|
||||||
.disabled(selectedIndex == 0)
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
|
|
||||||
// Active Title and Index Pill
|
|
||||||
HStack(spacing: 8) {
|
|
||||||
Image(systemName: currentTab.icon)
|
|
||||||
.font(.system(size: 16, weight: .semibold))
|
|
||||||
.foregroundStyle(currentTab.color)
|
|
||||||
|
|
||||||
Text(currentTab.title)
|
|
||||||
.font(.system(size: 15, weight: .bold, design: .rounded))
|
|
||||||
.foregroundStyle(.primary)
|
|
||||||
|
|
||||||
Text("\(selectedIndex + 1)/\(tabs.count)")
|
|
||||||
.font(.system(size: 11, weight: .semibold, design: .monospaced))
|
|
||||||
.padding(.horizontal, 6)
|
|
||||||
.padding(.vertical, 2)
|
|
||||||
.background(currentTab.color.opacity(0.2))
|
|
||||||
.foregroundStyle(currentTab.color)
|
|
||||||
.clipShape(Capsule())
|
|
||||||
}
|
|
||||||
.padding(.horizontal, 14)
|
|
||||||
.padding(.vertical, 6)
|
|
||||||
.background(
|
|
||||||
Capsule()
|
|
||||||
.fill(.regularMaterial)
|
|
||||||
.shadow(color: currentTab.color.opacity(0.25), radius: 8, x: 0, y: 3)
|
|
||||||
)
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
|
|
||||||
// Next button
|
|
||||||
Button(action: {
|
|
||||||
selectNext()
|
|
||||||
}) {
|
|
||||||
Image(systemName: "chevron.right")
|
|
||||||
.font(.system(size: 14, weight: .bold))
|
|
||||||
.foregroundStyle(selectedIndex < tabs.count - 1 ? currentTab.color : Color.gray.opacity(0.4))
|
|
||||||
.frame(width: 28, height: 28)
|
|
||||||
.background(Color.white.opacity(0.15))
|
|
||||||
.clipShape(Circle())
|
|
||||||
}
|
|
||||||
.disabled(selectedIndex == tabs.count - 1)
|
|
||||||
}
|
|
||||||
.padding(.horizontal, 20)
|
|
||||||
|
|
||||||
// MARK: - Wheel Dial Track
|
// MARK: - Wheel Dial Track
|
||||||
GeometryReader { geometry in
|
GeometryReader { geometry in
|
||||||
let centerPoint = geometry.size.width / 2
|
let centerPoint = geometry.size.width / 2
|
||||||
|
|
@ -152,7 +92,7 @@ struct WheelNavBar: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.frame(height: 72)
|
.frame(height: 64)
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
.gesture(
|
.gesture(
|
||||||
DragGesture()
|
DragGesture()
|
||||||
|
|
@ -178,7 +118,7 @@ struct WheelNavBar: View {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.padding(.vertical, 12)
|
.padding(.vertical, 6)
|
||||||
.background(
|
.background(
|
||||||
RoundedRectangle(cornerRadius: 28, style: .continuous)
|
RoundedRectangle(cornerRadius: 28, style: .continuous)
|
||||||
.fill(.ultraThinMaterial)
|
.fill(.ultraThinMaterial)
|
||||||
|
|
@ -191,22 +131,4 @@ struct WheelNavBar: View {
|
||||||
.padding(.horizontal, 16)
|
.padding(.horizontal, 16)
|
||||||
.padding(.bottom, 8)
|
.padding(.bottom, 8)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func selectPrevious() {
|
|
||||||
if selectedIndex > 0 {
|
|
||||||
withAnimation(.spring(response: 0.35, dampingFraction: 0.75)) {
|
|
||||||
selectedIndex -= 1
|
|
||||||
feedback.impactOccurred()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private func selectNext() {
|
|
||||||
if selectedIndex < tabs.count - 1 {
|
|
||||||
withAnimation(.spring(response: 0.35, dampingFraction: 0.75)) {
|
|
||||||
selectedIndex += 1
|
|
||||||
feedback.impactOccurred()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue