Widget appearance tweaks
This commit is contained in:
parent
32feb827f1
commit
e98e82d4ec
|
@ -48,11 +48,16 @@ struct RecentsEntryView: View {
|
|||
let entry: RecentsEntry
|
||||
|
||||
@Environment(\.widgetFamily) var family
|
||||
@Environment(\.colorScheme) var colorScheme
|
||||
|
||||
var body: some View {
|
||||
if #available(iOS 17.0, *) {
|
||||
content
|
||||
.containerBackground(.background, for: .widget)
|
||||
// the system padding is too much :S
|
||||
.padding(-4)
|
||||
.containerBackground(for: .widget) {
|
||||
colorScheme == .dark ? Color.black : .white
|
||||
}
|
||||
} else {
|
||||
content
|
||||
.padding()
|
||||
|
@ -68,10 +73,11 @@ struct RecentsEntryView: View {
|
|||
SquareItemView(item: entry.items[0])
|
||||
|
||||
case .systemMedium, .systemLarge:
|
||||
VStack {
|
||||
VStack(spacing: 0) {
|
||||
ForEach(Array(entry.items.prefix(family.maxItemCount).enumerated()), id: \.element.id) { (index, item) in
|
||||
if index != 0 {
|
||||
Divider()
|
||||
Spacer(minLength: 4)
|
||||
}
|
||||
ItemListEntryView(item: item)
|
||||
Spacer(minLength: 4)
|
||||
|
@ -124,12 +130,7 @@ private extension WidgetFamily {
|
|||
}
|
||||
|
||||
private var feedFont = Font.subheadline.weight(.medium).italic()
|
||||
private var titleUIFont: UIFont {
|
||||
// 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)
|
||||
private var titleFont = Font.headline.width(.compressed)
|
||||
|
||||
struct SquareItemView: View {
|
||||
let item: WidgetData.Item
|
||||
|
|
Loading…
Reference in New Issue