Skip to content

Commit

Permalink
Do not artificially stretch images
Browse files Browse the repository at this point in the history
  • Loading branch information
micahmo committed Dec 1, 2023
1 parent d315bf6 commit 60e2d0b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/shared/image_preview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,13 @@ class _ImagePreviewState extends State<ImagePreview> {
maxHeight: MediaQuery.of(context).size.width * 0.55,
maxWidth: MediaQuery.of(context).size.width * 0.60,
)
: null,
: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width - 24,
),
alignment: widget.isComment == true ? Alignment.topCenter : Alignment.center,
widget.url!,
height: widget.height,
width: widget.width ?? MediaQuery.of(context).size.width - 24,
width: widget.width,
fit: BoxFit.cover,
cache: true,
clearMemoryCacheWhenDispose: false,
Expand All @@ -116,11 +118,13 @@ class _ImagePreviewState extends State<ImagePreview> {
maxHeight: MediaQuery.of(context).size.width * 0.55,
maxWidth: MediaQuery.of(context).size.width * 0.60,
)
: null,
: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width - 24,
),
alignment: widget.isComment == true ? Alignment.topCenter : Alignment.center,
widget.bytes!,
height: widget.height,
width: widget.width ?? MediaQuery.of(context).size.width - 24,
width: widget.width,
fit: BoxFit.cover,
clearMemoryCacheWhenDispose: true,
cacheWidth: ((MediaQuery.of(context).size.width - 24) * View.of(context).devicePixelRatio.ceil()).toInt(),
Expand Down

0 comments on commit 60e2d0b

Please sign in to comment.