mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 13:05:11 +00:00
chore: Follow up img tag
This commit is contained in:
parent
01b61d031f
commit
d6bd765d66
1 changed files with 11 additions and 9 deletions
|
@ -239,21 +239,23 @@ class ImageExtension extends HtmlExtension {
|
|||
ExtensionContext context,
|
||||
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') {
|
||||
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,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue