Widget appearance tweaks

This commit is contained in:
Shadowfacts 2023-09-23 18:05:20 -04:00
parent 32feb827f1
commit e98e82d4ec
1 changed files with 9 additions and 8 deletions

View File

@ -48,11 +48,16 @@ struct RecentsEntryView: View {
let entry: RecentsEntry let entry: RecentsEntry
@Environment(\.widgetFamily) var family @Environment(\.widgetFamily) var family
@Environment(\.colorScheme) var colorScheme
var body: some View { var body: some View {
if #available(iOS 17.0, *) { if #available(iOS 17.0, *) {
content content
.containerBackground(.background, for: .widget) // the system padding is too much :S
.padding(-4)
.containerBackground(for: .widget) {
colorScheme == .dark ? Color.black : .white
}
} else { } else {
content content
.padding() .padding()
@ -68,10 +73,11 @@ struct RecentsEntryView: View {
SquareItemView(item: entry.items[0]) SquareItemView(item: entry.items[0])
case .systemMedium, .systemLarge: case .systemMedium, .systemLarge:
VStack { VStack(spacing: 0) {
ForEach(Array(entry.items.prefix(family.maxItemCount).enumerated()), id: \.element.id) { (index, item) in ForEach(Array(entry.items.prefix(family.maxItemCount).enumerated()), id: \.element.id) { (index, item) in
if index != 0 { if index != 0 {
Divider() Divider()
Spacer(minLength: 4)
} }
ItemListEntryView(item: item) ItemListEntryView(item: item)
Spacer(minLength: 4) Spacer(minLength: 4)
@ -124,12 +130,7 @@ private extension WidgetFamily {
} }
private var feedFont = Font.subheadline.weight(.medium).italic() private var feedFont = Font.subheadline.weight(.medium).italic()
private var titleUIFont: UIFont { private var titleFont = Font.headline.width(.compressed)
// TODO: this should use the compressed SF Pro variant, but there's no API to get at it
let descriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .headline).withSymbolicTraits(.traitCondensed)!
return UIFont(descriptor: descriptor, size: 0)
}
private var titleFont = Font(titleUIFont).leading(.tight)
struct SquareItemView: View { struct SquareItemView: View {
let item: WidgetData.Item let item: WidgetData.Item