flutter_html
flutter_html copied to clipboard
How to use ImageExtension ?
I previously added rounded corners to <img>
tags in an older version of flutter_html, but how should I achieve the same effect with the new ImageExtension?
customRender: {
'img': (context, child) {
return ClipRRect(
borderRadius: BorderRadius.circular(5.0),
child: (context.tree as ImageContentElement).toWidget(context),
);
}
}
Try this:
ImageExtension(
builder: (extensionContext) {
final element = extensionContext.styledElement as ImageElement;
return ClipRRect(
borderRadius: BorderRadius.circular(5.0),
child: Image.network(
element.src,
),
);
},
),
In current 3.0.0-beta.2 ImageElement is not defined for me. What is the current status of img tag?