change image fit
This commit is contained in:
parent
f0a26b58d1
commit
23e0aa3c4e
1 changed files with 28 additions and 27 deletions
|
|
@ -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),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue