Widget: More UI refinements

This commit is contained in:
Thomas Ricouard 2024-05-05 18:29:48 +02:00
parent a2afd4f58f
commit 7aebe530dd

View file

@ -49,14 +49,10 @@ struct LatestPostsWidgetProvider: AppIntentTimelineProvider {
if statuses.count >= 1 { if statuses.count >= 1 {
statuses = statuses.prefix(upTo: 1).map{ $0 } statuses = statuses.prefix(upTo: 1).map{ $0 }
} }
case .systemLarge: case .systemLarge, .systemExtraLarge:
if statuses.count >= 4 { if statuses.count >= 4 {
statuses = statuses.prefix(upTo: 4).map{ $0 } statuses = statuses.prefix(upTo: 4).map{ $0 }
} }
case .systemExtraLarge:
if statuses.count >= 6 {
statuses = statuses.prefix(upTo: 6).map{ $0 }
}
default: default:
break break
} }
@ -119,12 +115,9 @@ struct LatestPostsWidgetView : View {
var body: some View { var body: some View {
VStack(alignment: .leading, spacing: 8) { VStack(alignment: .leading, spacing: 8) {
headerView headerView
ForEach(entry.statuses) { status in VStack(alignment: .leading, spacing: 16) {
VStack(spacing: 4) { ForEach(entry.statuses) { status in
makeStatusView(status) makeStatusView(status)
if entry.statuses.last?.id != status.id {
Divider()
}
} }
} }
Spacer() Spacer()
@ -153,13 +146,14 @@ struct LatestPostsWidgetView : View {
.font(.body) .font(.body)
.lineLimit(contentLineLimit) .lineLimit(contentLineLimit)
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
.padding(.leading, 20)
} }
}) })
} }
} }
private func makeStatusHeaderView(_ status: Status) -> some View { private func makeStatusHeaderView(_ status: Status) -> some View {
HStack(spacing: 4) { HStack(alignment: .center, spacing: 4) {
if let image = entry.images[status.account.avatar] { if let image = entry.images[status.account.avatar] {
Image(uiImage: image) Image(uiImage: image)
.resizable() .resizable()