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