calculate image aspect ratio for more accurate blurhash

This commit is contained in:
Henry Hiles 2026-05-26 09:47:23 -04:00
commit 1d6a121ec4
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -316,19 +316,35 @@ class EventRenderer extends ConsumerWidget {
) => loadingProgress == null ) => loadingProgress == null
? child ? child
: switch (info?.blurHash) { : switch (info?.blurHash) {
final blurHash? => SizedBox( final blurHash? =>
width: info?.width ==
info?.width ?? null ||
info?.height ?? info?.height ==
200, null
height: ? SizedBox(
info?.height ?? width:
info?.width ?? 200,
200, height:
child: BlurHash( 200,
hash: blurHash, child: BlurHash(
), hash:
), blurHash,
),
)
: AspectRatio(
aspectRatio:
info!
.width! /
info.height!,
child: SizedBox(
width: info
.width,
child: BlurHash(
hash:
blurHash,
),
),
),
_ => Loading(), _ => Loading(),
}, },
errorBuilder: errorBuilder: