From 783178cc1ea8d1215d956e5a62cb5991a1cd7e1f Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Sat, 16 Jan 2021 00:19:20 +0100 Subject: [PATCH] Fixes #475 by passing the raw node to allow access to the raw attributes in a iframe customRender --- lib/src/replaced_element.dart | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/src/replaced_element.dart b/lib/src/replaced_element.dart index 666ced5073..06c4126516 100644 --- a/lib/src/replaced_element.dart +++ b/lib/src/replaced_element.dart @@ -138,16 +138,15 @@ class ImageContentElement extends ReplacedElement { } }); image.image.resolve(ImageConfiguration()).addListener( - ImageStreamListener( - (ImageInfo image, bool synchronousCall) { - var myImage = image.image; - Size size = Size(myImage.width.toDouble(), myImage.height.toDouble()); - completer.complete(size); - }, onError: (object, stacktrace) { - completer.completeError(object); - } - ), - ); + ImageStreamListener((ImageInfo image, bool synchronousCall) { + var myImage = image.image; + Size size = + Size(myImage.width.toDouble(), myImage.height.toDouble()); + completer.complete(size); + }, onError: (object, stacktrace) { + completer.completeError(object); + }), + ); imageWidget = FutureBuilder( future: completer.future, builder: (BuildContext buildContext, AsyncSnapshot snapshot) { @@ -158,7 +157,8 @@ class ImageContentElement extends ReplacedElement { height: snapshot.data.height, frameBuilder: (ctx, child, frame, _) { if (frame == null) { - return Text(alt ?? "", style: context.style.generateTextStyle()); + return Text(alt ?? "", + style: context.style.generateTextStyle()); } return child; }, @@ -418,12 +418,12 @@ ReplacedElement parseReplacedElement( ); case "iframe": return IframeContentElement( - name: "iframe", - src: element.attributes['src'], - width: double.tryParse(element.attributes['width'] ?? ""), - height: double.tryParse(element.attributes['height'] ?? ""), - navigationDelegate: navigationDelegateForIframe, - ); + name: "iframe", + src: element.attributes['src'], + width: double.tryParse(element.attributes['width'] ?? ""), + height: double.tryParse(element.attributes['height'] ?? ""), + navigationDelegate: navigationDelegateForIframe, + node: element); case "img": return ImageContentElement( name: "img",