From a4579a5760ad29a26e0774a2ae3842d191339404 Mon Sep 17 00:00:00 2001 From: Sorunome Date: Tue, 20 Jul 2021 20:32:43 +0200 Subject: [PATCH] fix: Make sure the aspect ratio of image bubbles stays the same --- lib/widgets/event_content/image_bubble.dart | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/widgets/event_content/image_bubble.dart b/lib/widgets/event_content/image_bubble.dart index 5c47fe4c..9f0ae5ba 100644 --- a/lib/widgets/event_content/image_bubble.dart +++ b/lib/widgets/event_content/image_bubble.dart @@ -355,6 +355,12 @@ class _ImageBubbleState extends State { content = getPlaceholderWidget(); key = 'placeholder'; } + if (widget.maxSize) { + content = AspectRatio( + aspectRatio: widget.width / widget.height, + child: content, + ); + } return ClipRRect( borderRadius: BorderRadius.circular(widget.radius), child: InkWell( @@ -365,8 +371,12 @@ class _ImageBubbleState extends State { duration: Duration(milliseconds: 1000), child: Container( key: ValueKey(key), - height: widget.maxSize ? widget.height : null, - width: widget.maxSize ? widget.width : null, + constraints: widget.maxSize + ? BoxConstraints.loose(Size( + widget.width, + widget.height, + )) + : null, child: content, ), ),