Add a wide layout option

This commit is contained in:
Thomas Ricouard 2024-09-22 11:30:47 +02:00
parent 56f0afb062
commit 70eb781407
4 changed files with 18 additions and 2 deletions

View file

@ -238,6 +238,7 @@ struct DisplaySettingsView: View {
}
Toggle("settings.display.show-account-popover", isOn: $userPreferences.showAccountPopover)
Toggle("Show Content Gradient", isOn: $theme.showContentGradient)
Toggle("Compact Layout", isOn: $theme.compactLayoutPadding)
}
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor)

View file

@ -20951,6 +20951,9 @@
}
}
}
},
"Compact Layout" : {
},
"Compose a post" : {
"localizations" : {

View file

@ -2,7 +2,10 @@ import Foundation
@MainActor
public extension CGFloat {
static let layoutPadding: CGFloat = 20
static var layoutPadding: CGFloat {
Theme.shared.compactLayoutPadding ? 20 : 8
}
static let dividerPadding: CGFloat = 2
static let scrollToViewHeight: CGFloat = 1
static let statusColumnsSpacing: CGFloat = 8

View file

@ -14,6 +14,7 @@ public final class Theme {
case lineSpacing
case statusActionSecondary
case contentGradient
case compactLayoutPadding
}
@AppStorage("is_previously_set") public var isThemePreviouslySet: Bool = false
@ -32,6 +33,7 @@ public final class Theme {
@AppStorage(ThemeKey.lineSpacing.rawValue) public var lineSpacing: Double = 1.2
@AppStorage(ThemeKey.statusActionSecondary.rawValue) public var statusActionSecondary: StatusActionSecondary = .share
@AppStorage(ThemeKey.contentGradient.rawValue) public var showContentGradient: Bool = true
@AppStorage(ThemeKey.compactLayoutPadding.rawValue) public var compactLayoutPadding: Bool = true
@AppStorage("font_size_scale") public var fontSizeScale: Double = 1
@AppStorage("chosen_font") public var chosenFontData: Data?
@ -291,6 +293,12 @@ public final class Theme {
}
}
public var compactLayoutPadding: Bool {
didSet {
themeStorage.compactLayoutPadding = compactLayoutPadding
}
}
public var selectedSet: ColorSetName = .iceCubeDark
public static let shared = Theme()
@ -332,6 +340,7 @@ public final class Theme {
chosenFontData = themeStorage.chosenFontData
statusActionSecondary = themeStorage.statusActionSecondary
showContentGradient = themeStorage.showContentGradient
compactLayoutPadding = themeStorage.compactLayoutPadding
selectedSet = storedSet
computeContrastingTintColor()