Text position on widget
Text position on widgets are now in a fixed position.
This commit is contained in:
parent
bc7341ec80
commit
4414ea6c06
|
@ -23,34 +23,53 @@ struct StarredWidgetView : View {
|
|||
}
|
||||
else {
|
||||
GeometryReader { metrics in
|
||||
HStack(alignment: .top, spacing: 4) {
|
||||
VStack(alignment: .leading, spacing: -4) {
|
||||
HStack {
|
||||
VStack {
|
||||
starredImage
|
||||
.padding(.vertical, 12)
|
||||
.padding(.leading, 8)
|
||||
Spacer()
|
||||
Text(L10n.localizedCount(entry.widgetData.currentStarredCount)).bold().font(.callout).minimumScaleFactor(0.5).lineLimit(1)
|
||||
Text(L10n.starred.lowercased()).bold().font(Font.system(.footnote).lowercaseSmallCaps()).minimumScaleFactor(0.5).lineLimit(1)
|
||||
}
|
||||
.frame(width: metrics.size.width * 0.15)
|
||||
.padding(.trailing, 4)
|
||||
|
||||
VStack(alignment:.leading, spacing: 0) {
|
||||
ForEach(0..<maxCount(), content: { i in
|
||||
if i != 0 {
|
||||
Divider()
|
||||
ArticleItemView(article: entry.widgetData.starredArticles[i],
|
||||
deepLink: WidgetDeepLink.starredArticle(id: entry.widgetData.starredArticles[i].id).url)
|
||||
.padding(.top, 8)
|
||||
.padding(.bottom, 4)
|
||||
} else {
|
||||
ArticleItemView(article: entry.widgetData.starredArticles[i],
|
||||
deepLink: WidgetDeepLink.starredArticle(id: entry.widgetData.starredArticles[i].id).url)
|
||||
.padding(.bottom, 4)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
.frame(width: metrics.size.width * 0.15)
|
||||
|
||||
Spacer()
|
||||
|
||||
VStack(alignment:.leading, spacing: 0) {
|
||||
ForEach(0..<maxCount(), content: { i in
|
||||
if i != 0 {
|
||||
Divider()
|
||||
ArticleItemView(article: entry.widgetData.starredArticles[i],
|
||||
deepLink: WidgetDeepLink.starredArticle(id: entry.widgetData.starredArticles[i].id).url)
|
||||
.padding(.top, 8)
|
||||
.padding(.bottom, 4)
|
||||
} else {
|
||||
ArticleItemView(article: entry.widgetData.starredArticles[i],
|
||||
deepLink: WidgetDeepLink.starredArticle(id: entry.widgetData.starredArticles[i].id).url)
|
||||
.padding(.bottom, 4)
|
||||
}
|
||||
})
|
||||
Spacer()
|
||||
}
|
||||
.padding(.leading, metrics.size.width * 0.175)
|
||||
.padding([.bottom, .trailing])
|
||||
.padding(.top, 12)
|
||||
.overlay(
|
||||
VStack {
|
||||
Spacer()
|
||||
}.padding(.leading, 4)
|
||||
}.padding()
|
||||
HStack {
|
||||
Spacer()
|
||||
Text(L10n.starredCount(entry.widgetData.currentStarredCount - maxCount()))
|
||||
.font(.caption2)
|
||||
.bold()
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
.padding(.horizontal)
|
||||
.padding(.bottom, 6)
|
||||
)
|
||||
|
||||
}.widgetURL(WidgetDeepLink.starred.url)
|
||||
|
||||
}
|
||||
|
|
|
@ -23,34 +23,53 @@ struct TodayWidgetView : View {
|
|||
}
|
||||
else {
|
||||
GeometryReader { metrics in
|
||||
HStack(alignment: .top, spacing: 4) {
|
||||
VStack(alignment: .leading, spacing: -4) {
|
||||
HStack {
|
||||
VStack {
|
||||
todayImage
|
||||
.padding(.vertical, 12)
|
||||
.padding(.leading, 8)
|
||||
Spacer()
|
||||
Text(L10n.localizedCount(entry.widgetData.currentTodayCount)).bold().font(.callout).minimumScaleFactor(0.5).lineLimit(1)
|
||||
Text(L10n.today.lowercased()).bold().font(Font.system(.footnote).lowercaseSmallCaps()).minimumScaleFactor(0.5).lineLimit(1)
|
||||
}
|
||||
.frame(width: metrics.size.width * 0.15)
|
||||
.padding(.trailing, 4)
|
||||
|
||||
VStack(alignment:.leading, spacing: 0) {
|
||||
ForEach(0..<maxCount(), content: { i in
|
||||
if i != 0 {
|
||||
Divider()
|
||||
ArticleItemView(article: entry.widgetData.todayArticles[i],
|
||||
deepLink: WidgetDeepLink.todayArticle(id: entry.widgetData.todayArticles[i].id).url)
|
||||
.padding(.top, 8)
|
||||
.padding(.bottom, 4)
|
||||
} else {
|
||||
ArticleItemView(article: entry.widgetData.unreadArticles[i],
|
||||
deepLink: WidgetDeepLink.todayArticle(id: entry.widgetData.todayArticles[i].id).url)
|
||||
.padding(.bottom, 4)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
.frame(width: metrics.size.width * 0.15)
|
||||
|
||||
Spacer()
|
||||
|
||||
VStack(alignment:.leading, spacing: 0) {
|
||||
ForEach(0..<maxCount(), content: { i in
|
||||
if i != 0 {
|
||||
Divider()
|
||||
ArticleItemView(article: entry.widgetData.todayArticles[i],
|
||||
deepLink: WidgetDeepLink.todayArticle(id: entry.widgetData.todayArticles[i].id).url)
|
||||
.padding(.top, 8)
|
||||
.padding(.bottom, 4)
|
||||
} else {
|
||||
ArticleItemView(article: entry.widgetData.todayArticles[i],
|
||||
deepLink: WidgetDeepLink.todayArticle(id: entry.widgetData.todayArticles[i].id).url)
|
||||
.padding(.bottom, 4)
|
||||
}
|
||||
})
|
||||
Spacer()
|
||||
}
|
||||
.padding(.leading, metrics.size.width * 0.175)
|
||||
.padding([.bottom, .trailing])
|
||||
.padding(.top, 12)
|
||||
.overlay(
|
||||
VStack {
|
||||
Spacer()
|
||||
}.padding(.leading, 4)
|
||||
}.padding()
|
||||
HStack {
|
||||
Spacer()
|
||||
Text(L10n.todayCount(entry.widgetData.currentTodayCount - maxCount()))
|
||||
.font(.caption2)
|
||||
.bold()
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
.padding(.horizontal)
|
||||
.padding(.bottom, 6)
|
||||
)
|
||||
|
||||
}.widgetURL(WidgetDeepLink.today.url)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,43 +23,61 @@ struct UnreadWidgetView : View {
|
|||
}
|
||||
else {
|
||||
GeometryReader { metrics in
|
||||
HStack(alignment: .top, spacing: 4) {
|
||||
VStack(alignment: .leading, spacing: -4) {
|
||||
HStack {
|
||||
VStack {
|
||||
unreadImage
|
||||
.padding(.vertical, 12)
|
||||
.padding(.leading, 8)
|
||||
Spacer()
|
||||
Text(L10n.localizedCount(entry.widgetData.currentUnreadCount)).bold().font(.callout).minimumScaleFactor(0.5).lineLimit(1)
|
||||
Text(L10n.unread.lowercased()).bold().font(Font.system(.footnote).lowercaseSmallCaps()).minimumScaleFactor(0.5).lineLimit(1)
|
||||
}
|
||||
.frame(width: metrics.size.width * 0.15)
|
||||
.padding(.trailing, 4)
|
||||
|
||||
VStack(alignment:.leading, spacing: 0) {
|
||||
ForEach(0..<maxCount(), content: { i in
|
||||
if i != 0 {
|
||||
Divider()
|
||||
ArticleItemView(article: entry.widgetData.unreadArticles[i],
|
||||
deepLink: WidgetDeepLink.unreadArticle(id: entry.widgetData.unreadArticles[i].id).url)
|
||||
.padding(.top, 8)
|
||||
.padding(.bottom, 4)
|
||||
} else {
|
||||
ArticleItemView(article: entry.widgetData.unreadArticles[i],
|
||||
deepLink: WidgetDeepLink.unreadArticle(id: entry.widgetData.unreadArticles[i].id).url)
|
||||
.padding(.bottom, 4)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
.frame(width: metrics.size.width * 0.15)
|
||||
|
||||
Spacer()
|
||||
|
||||
VStack(alignment:.leading, spacing: 0) {
|
||||
ForEach(0..<maxCount(), content: { i in
|
||||
if i != 0 {
|
||||
Divider()
|
||||
ArticleItemView(article: entry.widgetData.unreadArticles[i],
|
||||
deepLink: WidgetDeepLink.unreadArticle(id: entry.widgetData.unreadArticles[i].id).url)
|
||||
.padding(.top, 8)
|
||||
.padding(.bottom, 4)
|
||||
} else {
|
||||
ArticleItemView(article: entry.widgetData.unreadArticles[i],
|
||||
deepLink: WidgetDeepLink.unreadArticle(id: entry.widgetData.unreadArticles[i].id).url)
|
||||
.padding(.bottom, 4)
|
||||
}
|
||||
})
|
||||
Spacer()
|
||||
}
|
||||
.padding(.leading, metrics.size.width * 0.175)
|
||||
.padding([.bottom, .trailing])
|
||||
.padding(.top, 12)
|
||||
.overlay(
|
||||
VStack {
|
||||
Spacer()
|
||||
}.padding(.leading, 4)
|
||||
}.padding()
|
||||
}.widgetURL(WidgetDeepLink.unread.url)
|
||||
HStack {
|
||||
Spacer()
|
||||
Text(L10n.unreadCount(entry.widgetData.currentUnreadCount - maxCount()))
|
||||
.font(.caption2)
|
||||
.bold()
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
.padding(.horizontal)
|
||||
.padding(.bottom, 6)
|
||||
)
|
||||
}
|
||||
.widgetURL(WidgetDeepLink.unread.url)
|
||||
}
|
||||
}
|
||||
|
||||
var unreadImage: some View {
|
||||
Image(systemName: "largecircle.fill.circle")
|
||||
.resizable()
|
||||
.frame(width: 30, height: 30, alignment: .center)
|
||||
.cornerRadius(4)
|
||||
.frame(width: 30, height: 30, alignment: .top)
|
||||
.foregroundColor(.accentColor)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue