mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-04-27 10:24:44 +00:00
handle edge cases for StatusRowCardView
(#1985)
This commit is contained in:
parent
f4ec69a37f
commit
15d7d1dabd
1 changed files with 9 additions and 8 deletions
|
@ -234,13 +234,11 @@ struct DefaultPreviewImage: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
_Layout(originalWidth: originalWidth, originalHeight: originalHeight) {
|
_Layout(originalWidth: originalWidth, originalHeight: originalHeight) {
|
||||||
LazyResizableImage(url: url) { state, _ in
|
LazyResizableImage(url: url) { state, _ in
|
||||||
Rectangle()
|
if let image = state.image?.resizable() {
|
||||||
.fill(theme.secondaryBackgroundColor)
|
Rectangle().fill(theme.secondaryBackgroundColor)
|
||||||
.overlay {
|
.overlay { image.scaledToFill().blur(radius: 50) }
|
||||||
if let image = state.image {
|
.overlay { image.scaledToFit() }
|
||||||
image.resizable().scaledToFill()
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.accessibilityHidden(true) // This image is decorative
|
.accessibilityHidden(true) // This image is decorative
|
||||||
.clipped()
|
.clipped()
|
||||||
|
@ -264,7 +262,7 @@ struct DefaultPreviewImage: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func calculateSize(_ proposal: ProposedViewSize) -> CGSize {
|
private func calculateSize(_ proposal: ProposedViewSize) -> CGSize {
|
||||||
switch (proposal.width, proposal.height) {
|
var size = switch (proposal.width, proposal.height) {
|
||||||
case (nil, nil):
|
case (nil, nil):
|
||||||
CGSize(width: originalWidth, height: originalWidth)
|
CGSize(width: originalWidth, height: originalWidth)
|
||||||
case let (nil, .some(height)):
|
case let (nil, .some(height)):
|
||||||
|
@ -278,6 +276,9 @@ struct DefaultPreviewImage: View {
|
||||||
CGSize(width: width, height: width / originalWidth * originalHeight)
|
CGSize(width: width, height: width / originalWidth * originalHeight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size.height = min(size.height, 450)
|
||||||
|
return size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue