Remove VolumePicker (replaced by SettingsSlider with SliderFormat.percentage)
This commit is contained in:
parent
95a20ac5a3
commit
835e41841b
16
README.md
16
README.md
@ -222,16 +222,20 @@ SettingsToggle(
|
|||||||
isOn: $notificationsEnabled
|
isOn: $notificationsEnabled
|
||||||
)
|
)
|
||||||
|
|
||||||
// Volume slider
|
// Slider with format helpers
|
||||||
VolumePicker(label: "Volume", volume: $soundVolume)
|
SettingsSlider(
|
||||||
|
title: "Brightness",
|
||||||
|
subtitle: "Adjusts the brightness",
|
||||||
|
value: $brightness,
|
||||||
|
format: SliderFormat.percentage,
|
||||||
|
leadingIcon: Image(systemName: "sun.min"),
|
||||||
|
trailingIcon: Image(systemName: "sun.max.fill")
|
||||||
|
)
|
||||||
|
|
||||||
// Segmented picker
|
// Segmented picker
|
||||||
SegmentedPicker(
|
SegmentedPicker(
|
||||||
title: "Theme",
|
title: "Theme",
|
||||||
options: [
|
options: [("Light", "light"), ("Dark", "dark")],
|
||||||
SegmentedOption(label: "Light", value: "light"),
|
|
||||||
SegmentedOption(label: "Dark", value: "dark")
|
|
||||||
],
|
|
||||||
selection: $theme
|
selection: $theme
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -538,20 +538,6 @@ SelectableRow(
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### VolumePicker
|
|
||||||
|
|
||||||
A slider with speaker icons for volume/percentage values.
|
|
||||||
|
|
||||||
```swift
|
|
||||||
VolumePicker(
|
|
||||||
label: "Volume",
|
|
||||||
volume: $viewModel.volume,
|
|
||||||
accentColor: AppAccent.primary
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### BadgePill
|
### BadgePill
|
||||||
|
|
||||||
A capsule badge for values or tags.
|
A capsule badge for values or tags.
|
||||||
@ -725,7 +711,6 @@ SettingsCard(backgroundColor: AppSurface.card, borderColor: AppBorder.subtle) {
|
|||||||
| `SegmentedPicker` | Option selection | `title`, `options`, `selection` |
|
| `SegmentedPicker` | Option selection | `title`, `options`, `selection` |
|
||||||
| `SettingsRow` | Action rows | `systemImage`, `title`, `action` |
|
| `SettingsRow` | Action rows | `systemImage`, `title`, `action` |
|
||||||
| `SelectableRow` | Card selection | `title`, `isSelected`, `badge` |
|
| `SelectableRow` | Card selection | `title`, `isSelected`, `badge` |
|
||||||
| `VolumePicker` | Audio volume | `label`, `volume` |
|
|
||||||
| `BadgePill` | Price/tag badges | `text`, `isSelected` |
|
| `BadgePill` | Price/tag badges | `text`, `isSelected` |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@ -1,78 +0,0 @@
|
|||||||
//
|
|
||||||
// VolumePicker.swift
|
|
||||||
// Bedrock
|
|
||||||
//
|
|
||||||
// A volume slider with speaker icons.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
/// A volume slider with speaker icons.
|
|
||||||
///
|
|
||||||
/// Use this for audio volume or similar 0-1 range settings.
|
|
||||||
public struct VolumePicker: View {
|
|
||||||
/// The label for the picker.
|
|
||||||
public let label: String
|
|
||||||
|
|
||||||
/// Binding to the volume level (0.0 to 1.0).
|
|
||||||
@Binding public var volume: Float
|
|
||||||
|
|
||||||
/// The accent color for the slider.
|
|
||||||
public let accentColor: Color
|
|
||||||
|
|
||||||
/// Creates a volume picker.
|
|
||||||
/// - Parameters:
|
|
||||||
/// - label: The label text (default: "Volume").
|
|
||||||
/// - volume: Binding to volume (0.0-1.0).
|
|
||||||
/// - accentColor: The accent color (default: primary accent).
|
|
||||||
public init(
|
|
||||||
label: String = "Volume",
|
|
||||||
volume: Binding<Float>,
|
|
||||||
accentColor: Color = .Accent.primary
|
|
||||||
) {
|
|
||||||
self.label = label
|
|
||||||
self._volume = volume
|
|
||||||
self.accentColor = accentColor
|
|
||||||
}
|
|
||||||
|
|
||||||
public var body: some View {
|
|
||||||
VStack(alignment: .leading, spacing: Design.Spacing.small) {
|
|
||||||
HStack {
|
|
||||||
Text(label)
|
|
||||||
.font(.system(size: Design.BaseFontSize.medium, weight: .medium))
|
|
||||||
.foregroundStyle(.white)
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
|
|
||||||
Text("\(Int(volume * 100))%")
|
|
||||||
.font(.system(size: Design.BaseFontSize.body, weight: .medium, design: .rounded))
|
|
||||||
.foregroundStyle(.white.opacity(Design.Opacity.medium))
|
|
||||||
}
|
|
||||||
|
|
||||||
HStack(spacing: Design.Spacing.medium) {
|
|
||||||
Image(systemName: "speaker.fill")
|
|
||||||
.font(.system(size: Design.BaseFontSize.body))
|
|
||||||
.foregroundStyle(.white.opacity(Design.Opacity.medium))
|
|
||||||
|
|
||||||
Slider(value: $volume, in: 0...1, step: 0.1)
|
|
||||||
.tint(accentColor)
|
|
||||||
|
|
||||||
Image(systemName: "speaker.wave.3.fill")
|
|
||||||
.font(.system(size: Design.BaseFontSize.body))
|
|
||||||
.foregroundStyle(.white.opacity(Design.Opacity.medium))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.padding(.vertical, Design.Spacing.xSmall)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Preview
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
VStack(spacing: Design.Spacing.medium) {
|
|
||||||
VolumePicker(volume: .constant(0.8))
|
|
||||||
VolumePicker(label: "Music", volume: .constant(0.5))
|
|
||||||
}
|
|
||||||
.padding()
|
|
||||||
.background(Color.Surface.overlay)
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user