Skip to content

Commit 783178c

Browse files
committed
Fixes #475 by passing the raw node to allow access to the raw attributes in a iframe customRender
1 parent f9638ad commit 783178c

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

lib/src/replaced_element.dart

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,15 @@ class ImageContentElement extends ReplacedElement {
138138
}
139139
});
140140
image.image.resolve(ImageConfiguration()).addListener(
141-
ImageStreamListener(
142-
(ImageInfo image, bool synchronousCall) {
143-
var myImage = image.image;
144-
Size size = Size(myImage.width.toDouble(), myImage.height.toDouble());
145-
completer.complete(size);
146-
}, onError: (object, stacktrace) {
147-
completer.completeError(object);
148-
}
149-
),
150-
);
141+
ImageStreamListener((ImageInfo image, bool synchronousCall) {
142+
var myImage = image.image;
143+
Size size =
144+
Size(myImage.width.toDouble(), myImage.height.toDouble());
145+
completer.complete(size);
146+
}, onError: (object, stacktrace) {
147+
completer.completeError(object);
148+
}),
149+
);
151150
imageWidget = FutureBuilder<Size>(
152151
future: completer.future,
153152
builder: (BuildContext buildContext, AsyncSnapshot<Size> snapshot) {
@@ -158,7 +157,8 @@ class ImageContentElement extends ReplacedElement {
158157
height: snapshot.data.height,
159158
frameBuilder: (ctx, child, frame, _) {
160159
if (frame == null) {
161-
return Text(alt ?? "", style: context.style.generateTextStyle());
160+
return Text(alt ?? "",
161+
style: context.style.generateTextStyle());
162162
}
163163
return child;
164164
},
@@ -418,12 +418,12 @@ ReplacedElement parseReplacedElement(
418418
);
419419
case "iframe":
420420
return IframeContentElement(
421-
name: "iframe",
422-
src: element.attributes['src'],
423-
width: double.tryParse(element.attributes['width'] ?? ""),
424-
height: double.tryParse(element.attributes['height'] ?? ""),
425-
navigationDelegate: navigationDelegateForIframe,
426-
);
421+
name: "iframe",
422+
src: element.attributes['src'],
423+
width: double.tryParse(element.attributes['width'] ?? ""),
424+
height: double.tryParse(element.attributes['height'] ?? ""),
425+
navigationDelegate: navigationDelegateForIframe,
426+
node: element);
427427
case "img":
428428
return ImageContentElement(
429429
name: "img",

0 commit comments

Comments
 (0)