From d6bd765d6687bb5f1a76d57b3f797324e722e7a5 Mon Sep 17 00:00:00 2001 From: Krille Date: Mon, 22 May 2023 17:05:54 +0200 Subject: [PATCH] chore: Follow up img tag --- lib/pages/chat/events/html_message.dart | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/pages/chat/events/html_message.dart b/lib/pages/chat/events/html_message.dart index 523f030f..2e1965ef 100644 --- a/lib/pages/chat/events/html_message.dart +++ b/lib/pages/chat/events/html_message.dart @@ -239,21 +239,23 @@ class ImageExtension extends HtmlExtension { ExtensionContext context, Map Function() parseChildren, ) { - final mxcUrl = Uri.tryParse(context.attributes['href'] ?? ''); + final mxcUrl = Uri.tryParse(context.attributes['src'] ?? ''); if (mxcUrl == null || mxcUrl.scheme != 'mxc') { return TextSpan(text: context.attributes['alt']); } - final width = - double.tryParse(context.attributes['width'] ?? '') ?? defaultDimension; - final height = - double.tryParse(context.attributes['height'] ?? '') ?? defaultDimension; + final width = double.tryParse(context.attributes['width'] ?? ''); + final height = double.tryParse(context.attributes['height'] ?? ''); return WidgetSpan( - child: MxcImage( - uri: mxcUrl, - width: width, - height: height, + child: SizedBox( + width: width ?? height ?? defaultDimension, + height: height ?? width ?? defaultDimension, + child: MxcImage( + uri: mxcUrl, + width: width ?? height ?? defaultDimension, + height: height ?? width ?? defaultDimension, + ), ), ); }