Tryout: Fixed size optimizations

This commit is contained in:
Thomas Ricouard 2024-06-26 09:03:00 +02:00
parent 9887a81ef0
commit ff1d5733a0
2 changed files with 5 additions and 0 deletions

View file

@ -47,6 +47,7 @@ struct StatusRowHeaderView: View {
Group { Group {
EmojiTextApp(viewModel.finalStatus.account.cachedDisplayName, EmojiTextApp(viewModel.finalStatus.account.cachedDisplayName,
emojis: viewModel.finalStatus.account.emojis) emojis: viewModel.finalStatus.account.emojis)
.fixedSize(horizontal: false, vertical: true)
.font(.scaledSubheadline) .font(.scaledSubheadline)
.foregroundColor(theme.labelColor) .foregroundColor(theme.labelColor)
.emojiText.size(Font.scaledSubheadlineFont.emojiSize) .emojiText.size(Font.scaledSubheadlineFont.emojiSize)
@ -59,6 +60,7 @@ struct StatusRowHeaderView: View {
if !redactionReasons.contains(.placeholder) { if !redactionReasons.contains(.placeholder) {
accountBadgeView accountBadgeView
.fixedSize(horizontal: false, vertical: true)
.font(.footnote) .font(.footnote)
} }
} }
@ -69,6 +71,7 @@ struct StatusRowHeaderView: View {
theme.avatarPosition == .top theme.avatarPosition == .top
{ {
Text("@\(theme.displayFullUsername ? viewModel.finalStatus.account.acct : viewModel.finalStatus.account.username)") Text("@\(theme.displayFullUsername ? viewModel.finalStatus.account.acct : viewModel.finalStatus.account.username)")
.fixedSize(horizontal: false, vertical: true)
.font(.scaledFootnote) .font(.scaledFootnote)
.foregroundStyle(.secondary) .foregroundStyle(.secondary)
.lineLimit(1) .lineLimit(1)
@ -96,6 +99,7 @@ struct StatusRowHeaderView: View {
Text("") + Text("") +
Text(viewModel.finalStatus.createdAt.relativeFormatted) Text(viewModel.finalStatus.createdAt.relativeFormatted)
} }
.fixedSize(horizontal: false, vertical: true)
.font(.scaledFootnote) .font(.scaledFootnote)
.foregroundStyle(.secondary) .foregroundStyle(.secondary)
.lineLimit(1) .lineLimit(1)

View file

@ -19,6 +19,7 @@ struct StatusRowTextView: View {
emojis: viewModel.finalStatus.emojis, emojis: viewModel.finalStatus.emojis,
language: viewModel.finalStatus.language, language: viewModel.finalStatus.language,
lineLimit: viewModel.lineLimit) lineLimit: viewModel.lineLimit)
.fixedSize(horizontal: false, vertical: true)
.font(isFocused ? .scaledBodyFocused : .scaledBody) .font(isFocused ? .scaledBodyFocused : .scaledBody)
.lineSpacing(CGFloat(theme.lineSpacing)) .lineSpacing(CGFloat(theme.lineSpacing))
.foregroundColor(viewModel.textDisabled ? .gray : theme.labelColor) .foregroundColor(viewModel.textDisabled ? .gray : theme.labelColor)