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,17 +316,33 @@ class EventRenderer extends ConsumerWidget {
) => loadingProgress == null ) => loadingProgress == null
? child ? child
: switch (info?.blurHash) { : switch (info?.blurHash) {
final blurHash? => SizedBox( final blurHash? =>
info?.width ==
null ||
info?.height ==
null
? SizedBox(
width: width:
info?.width ??
info?.height ??
200, 200,
height: height:
info?.height ??
info?.width ??
200, 200,
child: BlurHash( child: BlurHash(
hash: blurHash, hash:
blurHash,
),
)
: AspectRatio(
aspectRatio:
info!
.width! /
info.height!,
child: SizedBox(
width: info
.width,
child: BlurHash(
hash:
blurHash,
),
), ),
), ),
_ => Loading(), _ => Loading(),