mirror of
https://github.com/cranci1/Sora.git
synced 2026-05-11 12:30:43 +00:00
make it so users can CHOOSE
This commit is contained in:
parent
6baa8e658b
commit
a58be1bdfa
1 changed files with 62 additions and 10 deletions
|
|
@ -192,6 +192,59 @@ fileprivate struct SettingsStepperRow: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fileprivate struct SettingsTextFieldRow: View {
|
||||||
|
let icon: String
|
||||||
|
let title: String
|
||||||
|
@Binding var value: Double
|
||||||
|
let range: ClosedRange<Double>
|
||||||
|
var showDivider: Bool = true
|
||||||
|
|
||||||
|
init(icon: String, title: String, value: Binding<Double>, range: ClosedRange<Double>, showDivider: Bool = true) {
|
||||||
|
self.icon = icon
|
||||||
|
self.title = title
|
||||||
|
self._value = value
|
||||||
|
self.range = range
|
||||||
|
self.showDivider = showDivider
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
VStack(spacing: 0) {
|
||||||
|
HStack {
|
||||||
|
Image(systemName: icon)
|
||||||
|
.frame(width: 24, height: 24)
|
||||||
|
.foregroundStyle(.primary)
|
||||||
|
|
||||||
|
Text(title)
|
||||||
|
.foregroundStyle(.primary)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
TextField("", value: $value, format: .number)
|
||||||
|
.keyboardType(.decimalPad)
|
||||||
|
.multilineTextAlignment(.trailing)
|
||||||
|
.frame(width: 60)
|
||||||
|
.onChange(of: value) { newValue in
|
||||||
|
if newValue < range.lowerBound {
|
||||||
|
value = range.lowerBound
|
||||||
|
} else if newValue > range.upperBound {
|
||||||
|
value = range.upperBound
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text("%")
|
||||||
|
.foregroundStyle(.gray)
|
||||||
|
}
|
||||||
|
.padding(.horizontal, 16)
|
||||||
|
.padding(.vertical, 12)
|
||||||
|
|
||||||
|
if showDivider {
|
||||||
|
Divider()
|
||||||
|
.padding(.horizontal, 16)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct SettingsViewPlayer: View {
|
struct SettingsViewPlayer: View {
|
||||||
@AppStorage("externalPlayer") private var externalPlayer: String = "Sora"
|
@AppStorage("externalPlayer") private var externalPlayer: String = "Sora"
|
||||||
@AppStorage("alwaysLandscape") private var isAlwaysLandscape = false
|
@AppStorage("alwaysLandscape") private var isAlwaysLandscape = false
|
||||||
|
|
@ -247,12 +300,11 @@ struct SettingsViewPlayer: View {
|
||||||
showDivider: true
|
showDivider: true
|
||||||
)
|
)
|
||||||
|
|
||||||
SettingsPickerRow(
|
SettingsTextFieldRow(
|
||||||
icon: "timer",
|
icon: "timer",
|
||||||
title: NSLocalizedString("Completion Percentage", comment: ""),
|
title: NSLocalizedString("Completion Percentage", comment: ""),
|
||||||
options: [60.0, 70.0, 80.0, 90.0, 95.0, 100.0],
|
value: $remainingTimePercentage,
|
||||||
optionToString: { "\(Int($0))%" },
|
range: 0...100,
|
||||||
selection: $remainingTimePercentage,
|
|
||||||
showDivider: false
|
showDivider: false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue