change image fit

This commit is contained in:
Henry Hiles 2026-06-06 17:30:24 -04:00
commit 23e0aa3c4e
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -18,6 +18,8 @@ class MessageImage extends ConsumerWidget {
url.toString(),
child: ClipRRect(
borderRadius: .all(.circular(8)),
child: AspectRatio(
aspectRatio: info!.width! / info!.height!,
child: Image(
image: CachedNetworkImage(
url.toString(),
@ -25,6 +27,7 @@ class MessageImage extends ConsumerWidget {
headers: ref.headers,
),
width: info?.width,
fit: BoxFit.fitWidth,
loadingBuilder: (_, child, loadingProgress) => loadingProgress == null
? child
: switch (info?.blurHash) {
@ -35,13 +38,10 @@ class MessageImage extends ConsumerWidget {
height: 200,
child: BlurHash(hash: blurHash),
)
: AspectRatio(
aspectRatio: info!.width! / info!.height!,
child: SizedBox(
: SizedBox(
width: info!.width,
child: BlurHash(hash: blurHash),
),
),
_ => Loading(),
},
errorBuilder: (context, error, stackTrace) => Center(
@ -52,5 +52,6 @@ class MessageImage extends ConsumerWidget {
),
),
),
),
);
}