fix: card thumbnail overflow — use GeometryReader to constrain image
Images with .fill were expanding beyond the 180pt frame because SwiftUI's .clipped() doesn't constrain the layout, only the rendering. Now uses GeometryReader to set explicit width + height on the image, then clips the container. Guarantees 180pt max regardless of image aspect ratio. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -255,10 +255,12 @@ struct EntryCardView: View {
|
|||||||
AsyncImage(url: thumbURL) { phase in
|
AsyncImage(url: thumbURL) { phase in
|
||||||
switch phase {
|
switch phase {
|
||||||
case .success(let image):
|
case .success(let image):
|
||||||
|
GeometryReader { geo in
|
||||||
image
|
image
|
||||||
.resizable()
|
.resizable()
|
||||||
.aspectRatio(contentMode: .fill)
|
.aspectRatio(contentMode: .fill)
|
||||||
.frame(maxWidth: .infinity)
|
.frame(width: geo.size.width, height: 180)
|
||||||
|
}
|
||||||
.frame(height: 180)
|
.frame(height: 180)
|
||||||
.clipped()
|
.clipped()
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user