|
|
@ -29,7 +29,7 @@ class ImageEmbedBuilder implements EmbedBuilder { |
|
|
|
|
|
|
|
|
|
|
|
var image; |
|
|
|
var image; |
|
|
|
final imageUrl = standardizeImageUrl(node.value.data); |
|
|
|
final imageUrl = standardizeImageUrl(node.value.data); |
|
|
|
Tuple2<double?, double?>? _widthHeight; |
|
|
|
OptionalSize? _imageSize; |
|
|
|
final style = node.style.attributes['style']; |
|
|
|
final style = node.style.attributes['style']; |
|
|
|
if (base.isMobile() && style != null) { |
|
|
|
if (base.isMobile() && style != null) { |
|
|
|
final _attrs = base.parseKeyValuePairs(style.value.toString(), { |
|
|
|
final _attrs = base.parseKeyValuePairs(style.value.toString(), { |
|
|
@ -45,7 +45,7 @@ class ImageEmbedBuilder implements EmbedBuilder { |
|
|
|
'mobileWidth and mobileHeight must be specified'); |
|
|
|
'mobileWidth and mobileHeight must be specified'); |
|
|
|
final w = double.parse(_attrs[Attribute.mobileWidth]!); |
|
|
|
final w = double.parse(_attrs[Attribute.mobileWidth]!); |
|
|
|
final h = double.parse(_attrs[Attribute.mobileHeight]!); |
|
|
|
final h = double.parse(_attrs[Attribute.mobileHeight]!); |
|
|
|
_widthHeight = Tuple2(w, h); |
|
|
|
_imageSize = OptionalSize(w, h); |
|
|
|
final m = _attrs[Attribute.mobileMargin] == null |
|
|
|
final m = _attrs[Attribute.mobileMargin] == null |
|
|
|
? 0.0 |
|
|
|
? 0.0 |
|
|
|
: double.parse(_attrs[Attribute.mobileMargin]!); |
|
|
|
: double.parse(_attrs[Attribute.mobileMargin]!); |
|
|
@ -56,9 +56,9 @@ class ImageEmbedBuilder implements EmbedBuilder { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (_widthHeight == null) { |
|
|
|
if (_imageSize == null) { |
|
|
|
image = imageByUrl(imageUrl); |
|
|
|
image = imageByUrl(imageUrl); |
|
|
|
_widthHeight = Tuple2((image as Image).width, image.height); |
|
|
|
_imageSize = OptionalSize((image as Image).width, image.height); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!readOnly && base.isMobile()) { |
|
|
|
if (!readOnly && base.isMobile()) { |
|
|
@ -88,8 +88,8 @@ class ImageEmbedBuilder implements EmbedBuilder { |
|
|
|
..formatText( |
|
|
|
..formatText( |
|
|
|
res.item1, 1, StyleAttribute(attr)); |
|
|
|
res.item1, 1, StyleAttribute(attr)); |
|
|
|
}, |
|
|
|
}, |
|
|
|
imageWidth: _widthHeight?.item1, |
|
|
|
imageWidth: _imageSize?.width, |
|
|
|
imageHeight: _widthHeight?.item2, |
|
|
|
imageHeight: _imageSize?.height, |
|
|
|
maxWidth: _screenSize.width, |
|
|
|
maxWidth: _screenSize.width, |
|
|
|
maxHeight: _screenSize.height); |
|
|
|
maxHeight: _screenSize.height); |
|
|
|
}); |
|
|
|
}); |
|
|
|