add a label to show the current

and grouped the slider and the label
This commit is contained in:
neon443
2025-07-09 20:39:34 +01:00
parent 76e15eaea2
commit 6c32fda78d

View File

@@ -10,13 +10,21 @@ import SwiftUI
struct FontManagerView: View { struct FontManagerView: View {
@ObservedObject var hostsManager: HostsManager @ObservedObject var hostsManager: HostsManager
@State var testLine: String = "the lazy bronw fox jumps over the lazy dog" @State var testLine: String = "the lazy brown fox jumps over the lazy dog"
var body: some View { var body: some View {
List { List {
Slider(value: $hostsManager.fontSize, in: 1...15, step: 1) { VStack {
HStack {
Text("Font Size")
Spacer()
Text("\(Int(hostsManager.fontSize))") Text("\(Int(hostsManager.fontSize))")
// Label("\(Int(hostsManager.fontSize))", systemImage: "textformat.size") .contentTransition(.numericText())
}
.padding(.horizontal)
Slider(value: $hostsManager.fontSize, in: 1...20, step: 1) {
} minimumValueLabel: { } minimumValueLabel: {
Label("", systemImage: "textformat.size.smaller") Label("", systemImage: "textformat.size.smaller")
} maximumValueLabel: { } maximumValueLabel: {
@@ -24,6 +32,7 @@ struct FontManagerView: View {
} onEditingChanged: { bool in } onEditingChanged: { bool in
hostsManager.saveFonts() hostsManager.saveFonts()
} }
}
ForEach(FontFamilies.allCasesRaw, id: \.self) { fontName in ForEach(FontFamilies.allCasesRaw, id: \.self) { fontName in
let selected = hostsManager.selectedFont == fontName let selected = hostsManager.selectedFont == fontName