|
|
@ -272,14 +272,18 @@ class ImageExtension extends HtmlExtension {
|
|
|
|
final width = double.tryParse(context.attributes['width'] ?? '');
|
|
|
|
final width = double.tryParse(context.attributes['width'] ?? '');
|
|
|
|
final height = double.tryParse(context.attributes['height'] ?? '');
|
|
|
|
final height = double.tryParse(context.attributes['height'] ?? '');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final actualWidth = width ?? height ?? defaultDimension;
|
|
|
|
|
|
|
|
final actualHeight = height ?? width ?? defaultDimension;
|
|
|
|
|
|
|
|
|
|
|
|
return WidgetSpan(
|
|
|
|
return WidgetSpan(
|
|
|
|
child: SizedBox(
|
|
|
|
child: SizedBox(
|
|
|
|
width: width ?? height ?? defaultDimension,
|
|
|
|
width: actualWidth,
|
|
|
|
height: height ?? width ?? defaultDimension,
|
|
|
|
height: actualHeight,
|
|
|
|
child: MxcImage(
|
|
|
|
child: MxcImage(
|
|
|
|
uri: mxcUrl,
|
|
|
|
uri: mxcUrl,
|
|
|
|
width: width ?? height ?? defaultDimension,
|
|
|
|
width: actualWidth,
|
|
|
|
height: height ?? width ?? defaultDimension,
|
|
|
|
height: actualHeight,
|
|
|
|
|
|
|
|
isThumbnail: (actualWidth * actualHeight) > (256 * 256),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|