mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-24 14:32:37 +01:00
chore: Follow up img tag
This commit is contained in:
parent
3070b38d2e
commit
d88a1cd2d6
@ -239,21 +239,23 @@ class ImageExtension extends HtmlExtension {
|
|||||||
ExtensionContext context,
|
ExtensionContext context,
|
||||||
Map<StyledElement, InlineSpan> Function() parseChildren,
|
Map<StyledElement, InlineSpan> Function() parseChildren,
|
||||||
) {
|
) {
|
||||||
final mxcUrl = Uri.tryParse(context.attributes['href'] ?? '');
|
final mxcUrl = Uri.tryParse(context.attributes['src'] ?? '');
|
||||||
if (mxcUrl == null || mxcUrl.scheme != 'mxc') {
|
if (mxcUrl == null || mxcUrl.scheme != 'mxc') {
|
||||||
return TextSpan(text: context.attributes['alt']);
|
return TextSpan(text: context.attributes['alt']);
|
||||||
}
|
}
|
||||||
|
|
||||||
final width =
|
final width = double.tryParse(context.attributes['width'] ?? '');
|
||||||
double.tryParse(context.attributes['width'] ?? '') ?? defaultDimension;
|
final height = double.tryParse(context.attributes['height'] ?? '');
|
||||||
final height =
|
|
||||||
double.tryParse(context.attributes['height'] ?? '') ?? defaultDimension;
|
|
||||||
|
|
||||||
return WidgetSpan(
|
return WidgetSpan(
|
||||||
child: MxcImage(
|
child: SizedBox(
|
||||||
uri: mxcUrl,
|
width: width ?? height ?? defaultDimension,
|
||||||
width: width,
|
height: height ?? width ?? defaultDimension,
|
||||||
height: height,
|
child: MxcImage(
|
||||||
|
uri: mxcUrl,
|
||||||
|
width: width ?? height ?? defaultDimension,
|
||||||
|
height: height ?? width ?? defaultDimension,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user