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,36 +18,37 @@ class MessageImage extends ConsumerWidget {
url.toString(), url.toString(),
child: ClipRRect( child: ClipRRect(
borderRadius: .all(.circular(8)), borderRadius: .all(.circular(8)),
child: Image( child: AspectRatio(
image: CachedNetworkImage( aspectRatio: info!.width! / info!.height!,
url.toString(), child: Image(
ref.watch(CrossCacheController.provider), image: CachedNetworkImage(
headers: ref.headers, url.toString(),
), ref.watch(CrossCacheController.provider),
width: info?.width, headers: ref.headers,
loadingBuilder: (_, child, loadingProgress) => loadingProgress == null ),
? child width: info?.width,
: switch (info?.blurHash) { fit: BoxFit.fitWidth,
final blurHash? => loadingBuilder: (_, child, loadingProgress) => loadingProgress == null
info?.width == null || info?.height == null ? child
? SizedBox( : switch (info?.blurHash) {
width: 200, final blurHash? =>
height: 200, info?.width == null || info?.height == null
child: BlurHash(hash: blurHash), ? SizedBox(
) width: 200,
: AspectRatio( height: 200,
aspectRatio: info!.width! / info!.height!, child: BlurHash(hash: blurHash),
child: SizedBox( )
: SizedBox(
width: info!.width, width: info!.width,
child: BlurHash(hash: blurHash), child: BlurHash(hash: blurHash),
), ),
), _ => Loading(),
_ => Loading(), },
}, errorBuilder: (context, error, stackTrace) => Center(
errorBuilder: (context, error, stackTrace) => Center( child: Text(
child: Text( "Image Failed to Load",
"Image Failed to Load", style: .new(color: Theme.of(context).colorScheme.error),
style: .new(color: Theme.of(context).colorScheme.error), ),
), ),
), ),
), ),